logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: Parsing XmlLayout formatted events (or how to set up Chainsaw and log4net)
Date Sat, 04 Dec 2004 16:39:33 GMT
I installed Chainsaw by going to this URL:


And clicking on the "[Launch now!]" link. It opened fine and I was able
to run the tutorial that setup 3 sample recievers.

I must admit I'm shooting in the dark here so any help would be
appreciated. I'd like to setup Chainsaw to monitor my ASP.Net
application on my local machine (and other web servers in the office)
so I don't have to keep reloading text files. In my project, I added
this appender to my log4net config file:

<appender name="UdpAppender" type="log4net.Appender.UdpAppender,
<localPort value="8080" />
<remoteAddress value="" />
<remotePort value="4560" />
<layout type="log4net.Layout.XmlLayoutSchemaLog4j, log4net" />			

I added the UdpAppender to the root logger:

<level value="DEBUG" />
<appender-ref ref="UdpAppender" />

The right most panel in Chainsaw has a treeview where the root node is
called Receivers. I right clicked on that and was presented with the
following options:

New MulticastReceiver
New SocketHubReceiver
New SocketReceiver
New UDPReceiver
New XMLSocketReceiver
New LogFilePatternReceiver

When I click on "New UDPReceiver" the program presents me with some
options for adding the new UDPReciever. I'm not able to change the
active menu item but I can change the other ones (some are prefilled
for me):

active "false"
class "class.org.apache.log4j.net.UDPReceiver"
decoder "org.apache.xml.XMLDecoder"
loggerRepository "org.apache.log4j.Hierarchv@1ad186f"
name "Asp.Net"
paused "false"
port 4560
threshold ALL

Have you gotten Chainsaw and log4net to work together Simon?


--- Simon Wallis <mailing@wallis.ca> wrote:

> Hi, I'm using the UdpAppender to send events to another server on our
> network. I've got Chainsaw working for examining the events in
> real-time, but have also written my own app to receive the events.
> The events are sent to the app formatted using XmlLayout. In the app
> I would now like to parse the event info and insert the details into
> a database.
> Is there an easy way to parse XmlLayout-formatted events? I was
> hoping for something like LoggingEvent.LoadXml() but it doesn't exist
> :)
> Am I on my own here? If so, what would one usually do with
> XmlLayout-formatted events?
> Thanks,
> Simon.
> PS. Here's a sample event formatted with XmlLayout:
> 	<log4net:event logger="log4netTestHarness.WebForm1"
> timestamp="2004-12-02T14:22:09.4570099-05:00" level="FATAL"
> thread="30636"
> 		<log4net:message><![CDATA[This is a FATAL
> event.]]></log4net:message>
> 		<log4net:properties>
> 			<log4net:data name="log4net:HostName" value="ts1wdadesk08"/>
> 		</log4net:properties>
> 		<log4net:exception>Exception: System.ApplicationException Message:
> this is a test exception</log4net:exception>
> 	</log4net:event>

View raw message