Severity 17 is used for most errors related to resource shortages that an SA would probably
like to see sent to the errorlog. Here is a query that an SA can use to generate a script
that will turn “with_log” on for every severity 17 error (you can and should go through it and comment out
any error that you don’t actually want to see in the errorlog, as not all severity 17 have to do with adjustable resources).
select
"/*"
+ description
+ "*/"
+ char(10)
+ "exec sp_altermessage "
+ str(error,8,0)
+ ", 'with_log', true"
+ char(10)
+ "go"
FROM
master..sysmessages
WHERE
severity = 17
go
Sample output follows, just add "--" in front of exec to comment out any errors
you don't want logging turned on for.
[...]
/*There is insufficient memory to allocate the structures needed to set local
switches. Contact your System Administrator.*/
exec sp_altermessage 12881, 'with_log', true
go
/*Couldn't find an available partition descriptor. Raise the value of the
configuration parameter 'number of open partitions' for more partition
descriptors.*/
exec sp_altermessage 14126, 'with_log', true
go
/*Could not allocate a local hash table for '%S_INDINFO'. Raise the value of
configuration parameter 'procedure cache size'.*/
exec sp_altermessage 14131, 'with_log', true
go
[...]