UdpPocketTrace

It is a pocket executable which includes a trace listener and monitor . Trace listener sends data to monitor using Udp multicast channel.

The idea is to have a simple executable to bring with us and to use for monitoring the trace of any .NET application which use the trace. The UdpPocketTrace contains a TraceListener (http://msdn2.microsoft.com/en-us/library/system.diagnostics.tracelistener.aspx) that sends the tracing messages on the multicast channel. Using the multicast channel we can catch the trace of many applications on the same monitor. The UdpPocketTrace is also a listening Udp client console which can listen on a specific multicast channel. Read http://www.erg.abdn.ac.uk/users/gorry/course/intro-pages/uni-b-mcast.html for easy informations about Unicast, Broadcast, Multicast and Udp.

Usage

1. Copy assembly "UdpPocketTrace.exe" in the working folder of .NET application to be monitored. If the application is a web application copy assembly into the "bin" folder.

2. Edit the configuration file of .NET application to be monitored and add the UdpTraceListener (full qulified name: MarcoBarzaghi.Diagnostics.UpdTraceListener,UdpPocketTrace,Version=1.2.0.0, Culture=neutral, PublicKeyToken=1b9d6e7bb7056ad2) in the list of listeners of trace in the "system.diagnostics" configuration section (http://msdn2.microsoft.com/en-us/library/1txedc80(VS.71).aspx). In the configuration it has to specify the listener type and the data initialize. The initialization string is a semicolon separated string in which it is to specify the Ip and the port of multicast channel.

<system.diagnostics>
    <trace autoflush="true">
      <listeners>
         <add 
            name="udp" 
             type="MarcoBarzaghi.Diagnostics.UpdTraceListener,UdpPocketTrace,Version=1.2.0.0, Culture=neutral, PublicKeyToken=1b9d6e7bb7056ad2" 
             initializeData="ip=234.5.5.1;port=5555;" />
      </listeners>
   </trace>
</system.diagnostics>


3. Launch "UdpPocketTrace.exe" and specify Ip and port of multicast channel as initialized in (2).

UdpPocketTrace.exe 234.5.5.1 5555


4. Now it is possible to watch the tracing of the application. Type <enter> to exit.

Remarks

The UdpPocketTrace is compiled for .NET Framework 2.0 and it can be used only for monitoring .NET 2.0 application. The easy c# code allows compilations also for .NET Framerwork 1.x.

Note that using the existing commands of windows it is also possible to redirect stream into a file or filter the incoming stream.

UdpPocketTrace.exe 234.5.5.1 5555 > trace.log
UdpPocketTrace.exe 234.5.5.1 5555 | findstr Error

About Team

Author/Coordinator: Marco Barzaghi
Mail: marco.barzaghi@gmail.com
Blog: http://blogs.ugidotnet.org/markino

Last edited Jul 9, 2007 at 5:23 PM by markino, version 40