Trace
flags are used to temporarily set specific server characteristics or to switch off a particular behavior. There are two different trace flags pertaining to deadlocks, 1204 and 1222. The later is only available in SQL 2005/2008 and above and should be used if you are running under these sql server versions.
To turn on deadlock tracing:
-- SQL 2000 version
DBCC TRACEON (1204, -1)
-- SQL 2005 version
DBCC TRACEON (1222, -1)
Turn off deadlock tracing:
-- SQL 2000 version
DBCC TRACEOFF (1204, -1)
-- SQL 2005 version
DBCC TRACEOFF (1222, -1)
This will globally turn deadlock tracing.