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
[email protected]
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
log4perl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4perl-devel