How to find/modify SQLServer Agent logfile location?

To get the location of SQLServer Agent log file, the log file is called SQLAGENT.out
DECLARE @oem_errorlog nvarchar(255)
EXECUTE master.dbo.xp_instance_regread N’HKEY_LOCAL_MACHINE’,
@oem_errorlog OUTPUT,

PRINT @oem_errorlog

Sample Output: C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLAGENT.OUT

To modify location and name of SQLServer Agent logfile
USE [msdb]
EXEC msdb.dbo.sp_set_sqlagent_properties @errorlog_file=N’C:\temp\SQLAGENT.OUT’

To recycle SQLServer Agent logfile
EXEC msdb.dbo.sp_cycle_agent_errorlog
When SQLServer Agent recycles the logfile, SQLAGENT.out.1 is the 2nd most recent logfile and so on.

Leave a Reply

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

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.