How does one move SQL Server error log files to a new location?

Solution 1:

Use the SQL Configuration Manager.

Here are the steps to change the startup to use a different directory. Once done restart server:

enter image description here

Solution 2:

In SSMS go to server properties and look for start up parameters. Right-click in object explorer, properties, then advanced.

The path is the "e" switch. Change and restart.

It can't be set in documented SQL commands :-)

Basically, it's in the registry as one of the parameters to the sqlservr.exe binary when run as a windows service

Solution 3:

When you use SSMS and click on generate script it creates T-SQL like this

  USE [msdb]
    GO
    EXEC dbo.sp_set_sqlagent_properties @errorlog_file=N'C:MSSQL\Log\SQLAGENT.OUT'
    GO

I just verified that it works, just make sure that the folder exist otherwise agent won't start

you probably also need to run this first, probably the proc above is disabled (by default)

EXEC master.dbo.sp_configure 'show advanced options', 1

RECONFIGURE

EXEC master.dbo.sp_configure 'Agent XPs', 1

RECONFIGURE