You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by tm...@moneynet.com on 2001/08/07 18:19:46 UTC
Accessing MDC data in Appenders?
Everyone,
Are MDC's associated or stored with LoggingEvents? I need to create a
custom appender and I was hoping I could do the following:
// Set some custom fields to log
MDC.put("user", "joe");
MDC.put("id", "123");
cat.debug("User info: ");
// In custom appender class..bogus code for now..just an example
append(LoggingEvent evt) {
System.out.println("user: " + evt.getMDC().get("user"));
System.out.println("id: " + evt.getMDC().get("id"));
}
Is this possible? Or do I have still have to create custom LoggingEvent
class that have the fields I want?
Thanks,
- Tim
____________________________________________________
Timothy G. Mullé
Senior Software Architect
Reuters Valley Forge Solutions Center
1000 Madison Avenue
Norristown, PA 19403-2432
Phone: (610) 650-8600 x8340
Fax: (610) 650-8170
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org