SQL server has the provision to record logging information to the file SQL_server_<server-id>_<ddmmmyyyy>_<hhmmss>.log. In this file name, the server-id corresponds to the server ID shown in database_name.lg. For example, if the file name is SQL_server_123_05MAY2005_112609.log, 123 is the server ID of the SQL server and the rest of the file name is the timestamp when the file was created.
To enable logging for one connection, use the following syntax:
SET PRO_CONNECT LOG [ ON | OFF ][ WITH ({ STATEMENT, QUERY_PLAN })][AND LEVEL 1 | LEVEL 2 | LEVEL3 | LEVEL 4]
To enable logging for all connections, use the following syntax:
SET PRO_SERVER LOG [ ON | OFF ][ WITH ({ STATEMENT, QUERY_PLAN })][AND LEVEL 1 | LEVEL 2 | LEVEL3 | LEVEL 4]