[logback-user] System property based Discriminator
DK
desmond.kirrane at gmail.com
Fri Mar 11 09:25:11 UTC 2016
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?
import ch.qos.logback.classic.spi.ILoggingEvent;import
ch.qos.logback.core.sift.AbstractDiscriminator;public class
SysPropDiscriminator extends AbstractDiscriminator { 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; }}
--
View this message in context: http://logback.10977.n7.nabble.com/System-property-based-Discriminator-tp14750.html
Sent from the Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20160311/aad03172/attachment.html>
More information about the logback-user
mailing list