Hi,<br><br>Is it possible to use the substitution property mechanism from code when initializing logback?<br><br>LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();<br>try {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JoranConfigurator configurator = new JoranConfigurator();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; configurator.setContext(lc);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lc.shutdownAndReset();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Can&#39;t set the property here because the execution context is null<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; configurator.doConfigure(contextProperties.getProperty(&quot;logging.properties&quot;));<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; configurator.getExecutionContext().addSubstitutionProperty(&quot;<a href="http://service.name">service.name</a>&quot;, &quot;serviceOne&quot;); // I think this is to late to set the property and it isn&#39;t used anymore<br>
}<br>catch (JoranException je) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StatusPrinter.print(lc);<br>}<br><br>with configuration file:<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br><br>&lt;configuration&gt;<br>&nbsp; &lt;appender name=&quot;console&quot; class=&quot;ch.qos.logback.core.ConsoleAppender&quot;&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;layout class=&quot;ch.qos.logback.classic.PatternLayout&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pattern&gt;%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M [%line] - %msg%n&lt;/pattern&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/layout&gt;<br>&nbsp; &lt;/appender&gt;<br>
&nbsp; &lt;appender name=&quot;A2&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;<br>&nbsp;&nbsp;&nbsp; &lt;file&gt;log/${<a href="http://service.name">service.name</a>}.log&lt;/file&gt;<br>&nbsp;&nbsp;&nbsp; &lt;Append&gt;true&lt;/Append&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;layout class=&quot;ch.qos.logback.classic.PatternLayout&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pattern&gt;&gt;%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M [%line] - %msg%n&lt;/pattern&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/layout&gt;<br>&nbsp;&nbsp;&nbsp; &lt;triggeringPolicy class=&quot;ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;MaxFileSize&gt;10MB&lt;/MaxFileSize&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/triggeringPolicy&gt;<br>&nbsp;&nbsp;&nbsp; &lt;rollingPolicy class=&quot;ch.qos.logback.core.rolling.FixedWindowRollingPolicy&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;FileNamePattern&gt;log/${<a href="http://service.name">service.name</a>}.%i.log.zip&lt;/FileNamePattern&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;MinIndex&gt;1&lt;/MinIndex&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;MaxIndex&gt;10&lt;/MaxIndex&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/rollingPolicy&gt;<br>&nbsp; &lt;/appender&gt;<br>&nbsp; &lt;root&gt;<br>&nbsp;&nbsp;&nbsp; &lt;level value=&quot;INFO&quot;/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;appender-ref ref=&quot;console&quot;/&gt;<br>
&nbsp; &lt;/root&gt;<br>&lt;/configuration&gt;<br><br>making every service that reuses this configuration but log to it&#39;s own logfile.<br><br>Thanking you in advance,<br><br>Tom<br>