Where is my SQL Error log?
Today I found a new (for me), undocumented method for identifying the location of the SQL Error log. I knew you could either check the registry or use SQL Server Configuration Manager and the "startup parameters" option. I ran SQL Profiler while opening up a SQL Error log in SQL Server Management Studio and found that SERVERPROPERTY has an option called 'ErrorLogFileName', as demonstrated here:
SELECT SERVERPROPERTY('ErrorLogFileName')
Again - you won't find it in Books Online, so it is officially undocumented with all the risks that implies - but useful for large environments where you're not always sure where the error logs reside and need to collect them directly for root cause analysis.
Comments
Anonymous
May 31, 2010
Thanks!Anonymous
September 22, 2010
Another option would be executing XP_READERRORLOG. The result (5th row) will contain the full path of the error log file.