• Nice idea.

    I have used xp_cmdshell to pipe debug to logfile when transactions fail

    declare @msg varchar(255)

    set @msg = 'echo ' + 'debug text here' + ' > c:\log.txt'

    exec xp_cmdshell @msg ,NO_OUTPUT

    but this is better