views:

29

answers:

1

I am using Apache Chainsaw with python (using the XMLLayout formatter, sending log messages to Chainsaw)

How can I make Chainsaw display multiple log tabs, one for each logging source ? currently it displays all messages, regardless of which process sent them, to a single tab

+1  A: 

By default, Chainsaw routes events to tabs based by looking at the values of 'hostname' and 'application' properties of each logging event (essentially MDC entries if they exist).

If you define those properties in your XML representation of each logging event, Chainsaw will route events to individual tabs based on those values.

You can change the default tab routing expression from 'PROP.hostname - PROP.application' to anything you'd like - just use the expression syntax to identify which field or property name to use in the routing of events (in the application-wide preferences screen). More info on the expression syntax is available from the Help/Tutorial menu.

By the way, there is an updated version of Chainsaw - a developer snapshot, will be released soon - available here with a ton of new features: http://people.apache.org/~sdeboy

Scott
What are "MDC entries" ?
bugspy.net
I tried <event.. application="app"></event> but this didn't work. What is the exact XML format for the application property ?
bugspy.net
Chainsaw by default can pull in events conforming to the log4j dtd.
Scott
Here is a sample event XML fragment - note the log4j:properties node.<log4j:event logger="Unknown" timestamp="1284334863644" level="DEBUG" thread="AWT-EventQueue-0"><log4j:message><![CDATA[20100830 12:30:27.296 NOTICE RI- ]]></log4j:message><log4j:throwable><![CDATA[]]></log4j:throwable><log4j:locationInfo class="?" method="?" file="?" line="?"/><log4j:properties><log4j:data name="application" value="/Users/admin/RILog.txt"/><log4j:data name="hostname" value="file"/><log4j:data name="log4jid" value="1"/><log4j:data name="receiver" value="stack"/></log4j:properties></log4j:event>
Scott