SQL Server Deadlock – Trace Flag Running but No Message

automationdbccdeadlockscriptingsql server

Trace flags are used to temporarily set specific server
characteristics or to switch off a particular behavior

More information on the trace flags are here

DBCC TRACESTATUS

this above, is the command that shows all the trace flags that are currently running on my system.

enter image description here

I have 2 questions:

1) is there any other way to find the list of trace flags that are currently running, other than DBCC TRACESTATUS?

2) It can be seen on the picture above the trace flag 1222 is active but I am not receiving any email when a deadlock occurs. What else needs to be done?

Best Answer

The reason the server wasn’t sending emails is due to this flag not being set:

EXEC master..sp_altermessage 1205, 'WITH_LOG', TRUE;
GO

Even though it was logging in the event log via the trace flag, this also needs to set in order to trigger the emails. You can see the table here:

select * from master.sys.messages
where text like '%deadlock%'