SQL_DEBUG LOG_STMT
This server configuration keyword allows logging executed SQL statements in sqlserver.log.
The main advantage compared to SQl_DEBUG_LOG_STUB_MED is that the logging allows identifying which connection sent the statement so that it is easier to understand the statement executed by a specific connection.
Compared to the SQL_DEBUG LOG_STMT_TIMES, this keyword generates less output and the statement is logged before the execution (LOG_STMT_TIMES logs after execution). This makes it possible to identify a very long-running query by looking at the log.
Behavior Change
In V11.6 and later, the statement logging output produced by this configuration keyword has been changed to be in one line in JSON format and to include extra information such as the timestamp, the user, and the IP address of the client making the request.
For example:
{"timestamp":"Fri Aug 24 11:56:24 2018","ipaddr":"::ffff:127.0.0.1","db":"CTREESQL","user":"admin","thread":23,"operation":"OPEN","exectime":7,"tmptime":2,"statement":"select * from syscolumns order by width "}
See Also