How to connect a trace listener to a running process?

I'm not sure if this is possible in the way I imagine or not, so I hope someone can help me wrap my head around it.

I want to introduce TraceListener into a running process - sort of. I don’t care how I attach to the process, but the ultimate goal is to listen to the trace output of the current process and upload it to the console window.

I can attach everything to the process in order, and I can write TraceListener in order ... where I will peel off, this is a bit in the middle. Has anyone understood if this can be done? If so, can you give me a push in the right direction, because I do not see the forest for the trees here.

Maybe I'm trying to get it wrong?

+6
debugging c # remote-debugging
source share
3 answers

I do not think it is practical. It would be easy to create a listener at runtime, but this is what the application should do, it involves adding something to the list.

You may want to make sure that the default listener is not removed by using the OutputDebug Tool to listen.

+3
source share

Would a dbgview of sysinternals be enough for your needs? It will show you messages about the trace of all running processes without the need to configure a trace listener before the process starts.

+2
source share

When I want to view the debug output, I use a combination of log4net and DebugView . I can force log4net to control the configuration file so that I can change the log4net logging level at runtime, or I can use filters in DebugView.

+1
source share

All Articles