log4net •  C++ •  VB6 •  VBA •  .NET  •  Silverlight •  Windows Phone 7 •  ASP.NET

Universal Trace Monitor for Software Developers and Testers

DevTracer – Trace Monitor for 'log4net'

Devtracer Monitor can be used with log4net. When log4net is used during development with Visual Studio often the ConsoleAppender is used, which redirects the trace information to Visual Studio's output window. The disadvantage of this approach is that the performance is very poor.

Have a look at this simple code snippet:

log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
for (int i = 1; i <= 100; i++)
      log.InfoFormat("Message {0} of 1000",i);

The code does nothing but create 100 trace messages. It takes about 1.2 seconds to run with the ConsoleAppender. When using the DebugAppender and DevTracer Monitor the same code needs only about 0.04 second to run, which is about 30 times faster. The tests were run on an Intel(R) Core(TM)2 Duo P8700 CPU with 2.53 GHz with Visual Studio 2010.

Configure DevTracer for use with log4net

Below you find a sample app.config file which can be used with a windows forms application

<?xml version="1.0" encoding="utf-8" ?>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  <!-- configure DebugAppender -->

    <appender name="DebugAppender" type="log4net.Appender.DebugAppender">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />

      <level value="ALL" />
      <appender-ref ref="DebugAppender" />

  <!-- configure DevTracer to use port 12345 on localhost -->
    <trace autoflush="false" indentsize="4">
        <add name="myListener"
             type="NRSoftware.Tracer.Listener,NRSoftware.Tracer, Version=, Culture=neutral, PublicKeyToken=867dfab712f16c0b"
             initializeData="localhost:12345" />
        <!-- the following line removes the default listener, which sends trace information to Visual Studio's output window. 
              This shult always be removed, because the performance is ve3ry poor -->
        <remove name="Default" />


In this example DevTracer is configured using a configuration file. You can also use reflection to configure DevTracer, as described in Using DevTracer with .NET.

Of course DevTracer and log4net can be used any type of .NET application, like ASP.NET or WPF applications.