Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is an idea:</p> <p>You could write a custom log4net Appender and have it write messages (indirectly) to the XmlWriterTraceListener. Inside the Append method you simply send the message to System.Diagnostics. </p> <p>Here is one <a href="http://telldontask.wordpress.com/2008/07/23/log4net-custom-appender/" rel="nofollow noreferrer">example</a> of a custom Appender. </p> <p>In the example, Append is overridden. It is passed a LoggingEvent class/structure. For your purposes (to get the log4net output routed to an output format that can be read by SvcTraceViewer), you could write your output to System.Diagnostics (having first configured it to log to the XmlWriterTraceListener). You could either write using Trace.Write* methods, Trace.Trace* methods, or by TraceSources. </p> <p>For TraceSources, you could consider the TraceSource name to be the same as the logger name (which is available in the LoggingEvent class/structure). So, you could configure a TraceSource in your app.config file for each log4net logger name that you want to go into the xml file. Your Append logic then might look something like this:</p> <pre><code>protected override void Append(LoggingEvent le) { TraceSource ts = new TraceSource(le.LoggerName); // Not sure of logger name field in LoggingEvent ts.TraceEvent(LogLevelToTraceEventType(le.Level), 0, le.FormattedMessage); } </code></pre> <p>This might give you what you want. Note that I have not actually done this, so I cannot say if it is a good idea or not, but it certainly seems like it would work.</p> <p>Sorry for being brief, but am trying to finish this before have to leave.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload