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: System property based Discriminator
Sent from the Users mailing list archive at Nabble.com.