I'm trying to split logs based on a System property that changes dynamically at runtime.
Is the below Discriminator code the way to go?
Will this Discriminator get called for every log statement?
<pre>
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.sift.AbstractDiscriminator;
public class SysPropDiscriminator extends AbstractDiscriminator<ILoggingEvent> {
private static final String KEY = "PROP";
@Override
public String getDiscriminatingValue(ILoggingEvent event) {
String propValue = System.getProperty("my.property");
if (propValue == null || propValue.length() == 0) {
return "unknown";
} else {
return propValue;
}
}
@Override
public String getKey() {
return KEY;
}
}</pre>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://logback.10977.n7.nabble.com/System-property-based-Discriminator-tp14750.html">System property based Discriminator</a><br/>
Sent from the <a href="http://logback.10977.n7.nabble.com/Users-f3.html">Users mailing list archive</a> at Nabble.com.<br/>