By default SQL Server ERRORLOG is stored in "C:\Program Files\Microsoft SQL Server\InstanceFolder\MSSQL\Log" folder. The ERRORLOG location is configured as a startup parameter for SQL Server Service.
To change the location of ERRORLOG you need to modify the startup parameter -e.
For example, if you need to move logs to C:\Logs\ then replace the startup parameter as below:
Step 1:
Replace "-eC:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012\MSSQL\Log\ERRORLOG"
to "-eC:\Logs\ERRORLOG"
Step 2:
Restart SQL Server Service to apply changes. The ERRORLOG will be created to "C:\Logs" after SQL Server is restarted.
To change location for SQL Server Agent Logs:
Location for SQL Server Agent Log can be changed using T-SQL or SQL Server Management Studio.
Method 1: To change SQL Server Agent Log location right click on "Error Logs" node and select "Configure"
Provide new location for Log file in "Error Log File" path:
Click on "OK" and restart SQL Server Agent to apply changes.
Method 2: To change log location using T-SQL
To change log location using T-SQL you can use below code:
USE [msdb]
GO
EXEC msdb.dbo.sp_set_sqlagent_properties
@errorlog_file = N'C:\Logs\SQLAGENT.OUT'
GO
Execute this code and restart SQL Server agent to apply changes.
Hope This Helps!
Vishal
If you like this post, do like my Facebook Page -> SqlAndMe
EMail me your questions -> Vishal@SqlAndMe.com
Follow me on Twitter -> @SqlAndMe
Filed under: Management Studio, SQL Agent, SQL Configuration, SQLServer, SQLServer 2005, SQLServer 2008, SQLServer 2008 R2, SQLServer 2012