From: Mike S. <m...@pe...> - 2011-08-09 06:12:09
|
On Tue, 9 Aug 2011, Holger Jahn wrote: > Now, we would like to add some generic info to all of the logged > messages (OS name & version, for instance). Is there a way of telling > Log4perl to do this, i.e. without having to add this info manually to > all of the existing places where we currently log stuff? Hi Holger, absolutely, that's exactly what the so-called Mapped Diagnostic Context in Log4perl is for. As explained here: http://search.cpan.org/~mschilli/Log-Log4perl-1.33/lib/Log/Log4perl.pm#Mapped_Diagnostic_Context_%28MDC%29 your application can set certain values via MDC and your Log4perl layout can be configured to display the set value via the %X{name} placeholder in all your messages, without the need to touch the code of the application. Hope that helps. -- -- Mike Mike Schilli m...@pe... |