Christoph,

It depends. What type of custom data do you want to log. Does it change
per log call, per thread, per application instance? How do you want to
present/render the data.

If it is string data then it can be stored in the event properties and
rendered using the %P{name} pattern layout. If the value is constant, or
changes infrequently, you may be able to write it into the MDC (Mapped
Diagnostic Context) which is a thread local map. If the data changes for
each logging event then you will need to pass it with each call. There
is an example of writing a custom extension to log4net to pass
additional data in the log4net download at:
extensions\net\1.0\log4net.Ext.EventID

Nicko

> -----Original Message-----
> From: Christoph Walcher [mailto:[EMAIL PROTECTED] 
> Sent: 02 March 2005 14:26
> To: log4net-user@logging.apache.org
> Subject: Include Custom information in Logs
> 
> Hi,
> 
> We in our company would like to include custom data - this 
> means data from our distributed application architecture - in 
> our logs. What is the "best" way to do this? Is writing my 
> own Layout and "augment" the log entry here a recommended way 
> or are there more elegant alternatives?
> 
> Cheers
> Christoph
> 
> 

Reply via email to