Muokkaa

Jaa


Open Log File Viewer

Applies to: SQL Server

You can use Log File Viewer in SQL Server Management Studio to access information about errors and events that are captured in the following logs:

  • Audit Collection

  • Data Collection

  • Database Mail

  • Job History

  • SQL Server

  • SQL Server Agent

  • Windows events (These Windows events can also be accessed from Event Viewer.)

Beginning in SQL Server 2012 (11.x), you can use Registered Servers to view SQL Server log files from local or remote instances of SQL Server. By using Registered Servers, you can view the log files when the instances are either online or offline. For more information about online access, see the procedure "To view online log files from Registered Servers" later in this topic. For more information about how to access offline SQL Server log files, see View Offline Log Files.

You can open Log File Viewer in several ways, depending on the information that you want to view.

Permissions

To access log files for instances of SQL Server that are online, this requires membership in the securityadmin fixed server role.

To access log files for instances of SQL Server that are offline, you must have read access to both the Root\Microsoft\SqlServer\ComputerManagement10 WMI namespace, and to the folder where the log files are stored. For more information, see the Security section of the topic View Offline Log Files.

Security

Requires membership in the securityadmin fixed server role.

View Log Files

  1. In Object Explorer, expand Management.

  2. Do either of the following:

    • Right-click SQL Server Logs, point to View, and then click either SQL Server Log or SQL Server and Windows Log.

    • Expand SQL Server Logs, right-click any log file, and then click View SQL Server Log. You can also double-click any log file.

    The logs include Database Mail, SQL Server, SQL Server Agent, and Windows NT.

  • In Object Explorer, expand SQL Server Agent, right-click Jobs, and then click View History.

    The logs include Database Mail, Job History, and SQL Server Agent.

  • In Object Explorer, expand Management, right-click Maintenance Plans, and then click View History.

    The logs include Database Mail, Job History, Maintenance Plans, Remote Maintenance Plans, and SQL Server Agent.

  • In Object Explorer, expand Management, right-click Data Collection, and then click View Logs.

    The logs include Data Collection, Job History, and SQL Server Agent.

  • In Object Explorer, expand Management, right-click Database Mail, and then click View Database Mail Log.

    The logs include Database Mail, Job History, Maintenance Plans, Remote Maintenance Plans, SQL Server, SQL Server Agent, and Windows NT.

  • In Object Explorer, expand Security, expand Audits, right-click an audit, and then click View Audit Logs.

    The logs include Audit Collection and Windows NT.

See Also

Log File Viewer
SQL Server Audit (Database Engine)
View Offline Log Files