logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Wallis" <mail...@wallis.ca>
Subject Re: Parsing XmlLayout formatted events (or how to set up Chainsaw and log4net)
Date Mon, 06 Dec 2004 19:34:25 GMT
Hi Ron, yes I got Chainsaw working. My config is almost identical. The only differences are,
in log4net config, I have:

<layout type="log4net.Layout.XmlLayoutSchemaLog4j" />

(no ", log4net") on the end, not sure what that does.

Also, I don't send events to 127.0.0.1, I use a remote IP or if running locally I use the
actual IP of my machine.

And in Chainsaw UdpReceiver setup, I don't have a logger repository set, that line is blank.
Other than that all is the same and it works fine.

Simon.


---------- Original Message ----------------------------------
From: Ron Grabowski <rongrabowski@yahoo.com>
Reply-To: "Log4NET User" <log4net-user@logging.apache.org>
Date:  Sat, 4 Dec 2004 08:39:33 -0800 (PST)

>I installed Chainsaw by going to this URL:
>
> http://logging.apache.org/log4j/docs/chainsaw.html#Installation
>
>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,
>log4net">
><localPort value="8080" />
><remoteAddress value="127.0.0.1" />
><remotePort value="4560" />
><layout type="log4net.Layout.XmlLayoutSchemaLog4j, log4net" />			
></appender>
>
>I added the UdpAppender to the root logger:
>
><root>
><level value="DEBUG" />
><appender-ref ref="UdpAppender" />
></root>
>
>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"
>encoding
>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?
>
>Thanks,
>Ron
>
>--- 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"
>>
>domain="/LM/w3svc/1/root/test/log4netTestHarness-1-127465056731440543"
>> username="NT AUTHORITY\NETWORK SERVICE">
>> 		<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>
>> 
>> 
>
>

Mime
View raw message