Skip to content

Commit ce8ec70

Browse files
committed
Update Read_Error_Log_File script
1 parent 710b215 commit ce8ec70

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

Scripts/Read_Error_Log_File.sql

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Created: 2019-03-05 by Max Vernon
33
Modified: 2019-03-26 by Konstantin Taranov
44
Original link: https://www.sqlserverscience.com/tools/error-log-analysis-script/
55
Source link: https://github.com/ktaranov/sqlserver-kit/blob/master/Scripts/Read_Error_Log_File.sql
6-
Note: Shows the contents of the SQL Server Error Log files, up to a maximum of the most recent 6 files.
6+
Note: Shows the contents of the SQL Server Error Log files, up to a maximum of the most recent 9 files.
77
Certain "noisy" log messages are filtered out via the #exclusions temp table.
88
*/
99

@@ -87,7 +87,7 @@ IF @ErrorLogCount > 9 SET @ErrorLogCount = 9;
8787
DECLARE @FileNum INT;
8888
SET @FileNum = 0
8989

90-
WHILE @FileNum < 7-- @ErrorLogCount
90+
WHILE @FileNum < @ErrorLogCount
9191
BEGIN TRY
9292
SET @msg = 'Retreiving log ' + CONVERT(varchar(100), @FileNum);
9393
RAISERROR (@msg, 0, 1) WITH NOWAIT; --send progress to the "Messages" tab
@@ -99,8 +99,6 @@ BEGIN TRY
9999
SET ErrorLogFileNum = @FileNum
100100
WHERE ErrorLogFileNum IS NULL;
101101

102-
PRINT(@FileNum);
103-
104102
SET @FileNum = @FileNum + 1;
105103
END TRY
106104
BEGIN CATCH

0 commit comments

Comments
 (0)