logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Smith <Paul.Sm...@lawlex.com.au>
Subject LoggingEvent properties and appenders
Date Wed, 09 Apr 2003 23:11:25 GMT
During some offline discussions about Chainsaw with Scott Deboy, he
mentioned an interesting issue with regards to some additional properties
that Chainsaw would ideally be looking for as the remote logging events

The easiest example is an Application Name property that identifies which
app the logs are coming from.  With chainsaws new multi-tab concept, it's
easy to manage when each tab has the App name as the name of the tab.

Ideally, it would be nice if in the Log4j configuration of the source
application of the events, we could specify additional property Key/Value
pairs that are automatically set in each LoggingEvent as it passes through a
specific Appender.


<appender name="SocketAppender" class="org.apache.log4j.net.SocketAppender">
  <param name="remoteHost" value="localhost"/>
  <param name="port" value="4445"/>
  <param name="reconnectionDelay" value="500"/>
  <layout class="org.apache.log4j.xml.XMLLayout"/>

   <log4j:property name="Log4jApp" value="My Application Name" />
   <log4j:property name="SomeOtherValue" value="Blah" />


In this example (the log4j:property is just the first thing I could think
of), the SocketAppender automatically sets the properties "Log4JApp"  &
"SomeOtherValue" on the LoggingEvent before it get's "appended" to the
socket.  Now, I know we could get the Code generating the LoggingEvents to
put it in, but this seems a nicer way of doing it.

This way, we can have a flexible way to ensure some remote specific
properties get seen.

Does that make sense? (Scott, did I get this right?)

Paul Smith 
Lawlex Compliance Solutions
phone: +61 3 9278 1511
email: paul.smith@lawlex.com.au

To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

View raw message