Monday, November 12, 2018

Where is your SQL Server Error Log ?

Yes, yes, I know this sounds like a dumb question -- but it's not.  You inherit a server built by somebody else.  There's a problem, and you need to get into that error log fast.  Well... where is it?  This post is just a couple quick methods for finding your current SQL Server Error Log.

First, you have sp_readerrorlog which enables you to read the contents of the SQL Server Error Log w/a query.  In this case, I am specifically looking for the log entry beginning with 'Logging SQL Server messages in file'... but, you can actually use it to search for anything written to the log file.  

 EXEC sys.sp_readerrorlog @p1 =0,@p2 =1,@p3 ='Logging SQL Server messages in file'

Your output will be similar to this:


Or, maybe the problem is BIG and you cannot even get into SSMS to run a query.  You can also find the log location from within the SQL Server Configuration Manager, SQL Server (MSSQLSERVER) Properties, Startup Parameters -- that one prefaced with the -e is your error log location.



And there you have it!  Another post soon w/some other clever uses for sp_readerrorlog. 

No comments:

Post a Comment