How to Find SQL ERRORLOG Location in SQL Server

Most of the developers and DBAs working on SQL Server would probably have knowledge on how to find SQL ERRORLOG location. As the name says, the ERRORLOG is the place where all the error encountered in the SQL Server would be stored. Probably, the ERRORLOG comes in use when there is a need to check the issue in certain timeframe in SQL Server instance. The ERRORLOG is generated every time a new instance is created in SQL Server.

Let’s check how to find the ERRORLOG location and the number of ways to find it, though most of the people working on it would be familiar on it.

1. Use XP_READERRORLOG Stored Procedure

XP_READERRORLOG is a system stored procedure used to find the ERRORLOG in SQL Server.

USE MASTER
GO
EXEC xp_readerrorlog 0, 1, N'Logging SQL Server messages in file'
       GO 


In this case, the ERRORLOG is configured to store in the D:\ drive. The location can vary based on organization requirements.

2. Use SQL Server Configuration Manager

In case, if you are unable to get the ERRORLOG location using the XP_READERRORLOG stored proc, then proceed to use the SQL Server Configuration Manger to find the location.

Steps to get the ERRORLOG location from SQL Server Configuration Manager: 

1.       Open the SQL Server Configuration Manager application
2.       From the left window pane select “SQL Server Service”
3.       Right click on “SQL Server (Your Server Name)” option from the right pane.
4.       Click on properties for more options
5.       A new window pops with advanced multiple options. Select “Startup Parameter” option to get the location of ERROR LOG.
6.       ERRORLOG location is found under the tab “Existing Parameters” starts with a command as -e

Let’s look at the screenshot for the same:


0 comments:

Post a Comment