Where Is The SQL Server ErrorLog File?

I seldom lose things; I just cannot find them as quickly as I’d like. This is true for keys, tools, and yes even ErrorLog files on SQL Server.

On the servers that I configure, I have a standard way of doing things. I set them up using some industry best practices and some standards that I’ve developed over the years. On those servers, I can find the ErrorLog file quickly since it is in a predictable place for me.

Using T-SQL To Find The ErrorLog File

In my consulting practice, I regularly work with SQL Servers that I did not configure. For those servers, I must discover where things are. One technique that I use is to ask SQL Server itself where things are. For example, the following T-SQL query will return the location of the ErrorLog file.

SELECT SERVERPROPERTY(‘ErrorLogFileName’);

It will return something like the following:

E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG

This technique is particularly useful when I’m examining the ErrorLog in a PowerShell script. I blogged about that The Power Of RegEx in PowerShell.

Advertisements

9 Responses to Where Is The SQL Server ErrorLog File?

  1. Nitin says:

    Its particularly harder when the server is not starting up.

    Then the only choice is to do a desktop search

  2. If the SQL Server service can not start you can use SQL Server Configuration Manager, right-click your service, select Properties, Advanced, Startup Parameters and look for the -e parameter like in

    -eC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG

  3. Pingback: What SQL Server Service Pack Do I Have Installed? « WebbTech Solutions

  4. Pingback: A NULL Is Not Unknown « WebbTech Solutions

  5. Pingback: http://www.baobab-shelter.be/Comment-elaborer-une-strategie

  6. Pingback: SQL Server Blog

  7. BestHilda says:

    I have noticed you don’t monetize your page, don’t waste your traffic, you can earn additional bucks every month because you’ve got high quality content.
    If you want to know how to make extra money, search for:
    Ercannou’s essential adsense alternative

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s