Hello Tom,

You can put properties into any Context, in particular LoggerContext. So for example,

  lc.setProperty("service.name", "serviceOne");

will work in logback 0.9.9-SNAPSHOT. I am not so sure about 0.9.8.

I hope this helps,

Tom Eyckmans wrote:
Hi,

Is it possible to use the substitution property mechanism from code when initializing logback?

LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
try {
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(lc);
        lc.shutdownAndReset();

       // Can't set the property here because the execution context is null

configurator.doConfigure(contextProperties.getProperty("logging.properties"));

configurator.getExecutionContext().addSubstitutionProperty("service.name <http://service.name>", "serviceOne"); // I think this is to late to set

[snip]


Tom

--
Ceki Gülcü
QOS.ch is looking to hire talented developers in Switzerland.  If
interested, please contact c e k i @ q o s . c h

_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://qos.ch/mailman/listinfo/logback-user

Reply via email to