SQL log file

  • Is there a way from SQL management studio to find out what is the file path for SQL server log.txt file stored?

    Thanks

  • declare @dir nvarchar(4000)

    exec master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'SQLArg1', @dir output, 'no_output'

    if @dir is null

    begin

    exec master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Setup',N'SQLDataRoot', @dir output, 'no_output'

    select @dir = @dir + N'\LOG'

    end

    select @dir

    OR

    SELECT SERVERPROPERTY('ErrorLogFileName')

  • its listed right at the start of the errorlog after a sql restart (not just a errorlog cycle)

    ---------------------------------------------------------------------

  • I tried the following:

    D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG

    I recieved the following:

    (No column name)

    D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG

    The following code:

    SELECT SERVERPROPERTY('ErrorLogFileName')

    Returns:

    (No column name)

    D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG

    However the path of the error logs are:

    C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG

    ?:unsure:

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply