[logback-user] Nested sifting appenders
Dario Campagna
campagna at esteco.com
Fri Apr 20 14:13:37 CEST 2012
Hi Ceki,
> Would you like to post it on this list for future reference?
I created a new discriminator taking the code of MCDBasedDiscriminator
and modifying the method getDiscriminatingValue(ILoggingEvent event)
as follows.
public String getDiscriminatingValue(ILoggingEvent event) {
Map<String, String> mdcMap = event.getMDCPropertyMap();
// If the MDC is empty return the default path
if (mdcMap.isEmpty()) {
return defaultValue;
}
String parentValue = mdcMap.get("parent");
String nodeValue = mdcMap.get("node");
return parentValue + "/" + nodeValue;
}
Cheers,
Dario
More information about the Logback-user
mailing list