19.11.2010 19:08, Steve Teale пишет:
On Fri, 19 Nov 2010 16:58:26 +0300, Stanislav Blinov wrote:Have you tried OutputDebugString()? It's WinAPI function that sends strings to the 'debugger'. DebugView application from SysInternals suite nicely prints those strings, and also times them.How is this better than the event log. It only takes one line of code, but it's still a pain in the arse.
It's better precisely in that it doesn't need event log. Cluttering system log with debug messages is not a thing I personally like :)
In any case, if it's a service, where does it output the debug string to?
It's not a console output. That function generates special Windows debug event that can be captured by external application (i.e. debugger, but not necessarily). It is very useful with things like services when console is not available and you don't feel like creating log file. SysInternals suite has a DebugView application that captures these debug strings from currently running processes and displays them as a kind of log: they are numbered and timed (see attached screenshot).
<<attachment: debugview.png>>
