capture unmanaged OutputDebugString output using a TraceListener class

  • Thread starter Thread starter ellipsisware
  • Start date Start date
E

ellipsisware

Guest
I have a legacy MFC application that uses OutputDebugString to emit debugging information, the application also uses .NET libraries that emit debugging information using System.Diagnostics.Trace

If I add the following to the applications .config file:

<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\ProgramData\Foo\TextWriterOutput.log" />
</listeners>
</trace>
</system.diagnostics>


and then run the application, the .NET output emitted is appended to the log but not the output from unmanaged code using OutputDebugString.

Is it possible to capture both OutputDebugString and System.Diagnostics.Trace.Write output using a TraceListener class, both Visual Studio and DebugView can display such output (from my application) and I would like to have the ability to generate a log file (displaying the trace output along with the process ID and a timestamp) but without having to run DebugView

Continue reading...
 
Back
Top