views:

192

answers:

2

Hello, do you know if it's possible to capture debug output (create debug listener) in C#? I'd like to have functionality like DebugView has, but I'd like to log debug output to SQL server. Or maybe a better way would be to make DebugView log to a file, and then feed the file to SQL server?

Edit: I've implemented TraceListener and added it to Debug.Listeners collection, but it seems to capture debug only from my application. What I want to do is to capture debug from all applications, is there a way to do that?

A: 

Unless you truly have a specific need to roll your own logger, I would use an existing logging framework such as log4net. It has an ADO.NET appender that you can configure to log debug or trace output directly to sql server.

James H
I need to capture debug output from other applications, not just mine, so this is not about 'where to log stuff', but 'how to log stuff from other apps'
Axarydax
+3  A: 

DbMon.NET - A simple .NET OutputDebugString capturer at http://www.codeproject.com/KB/trace/DbMonNET.aspx seems to do what you want.

ShellShock