Hi, again with another question.<br><br>With aspectj, in injecting a var in MCD, something like this...<br><br>MDC.put(&quot;code&quot;,var);<br><br>in some places, depending something, and i&#39;m using this to generate a diferent file for this something like<br>
<br>    &lt;appender name=&quot;APPENDER&quot; class=&quot;ch.qos.logback.classic.sift.SiftingAppender&quot;&gt;
<br>        &lt;filter class=&quot;ch.qos.logback.core.filter.EvaluatorFilter&quot;&gt;
<br>            &lt;evaluator class=&quot;ch.qos.logback.classic.boolex.JaninoEventEvaluator&quot;&gt;
<br>                  &lt;expression&gt;
<br>                    (marker != null) 
<br>                    &amp;amp;&amp;amp; (
<br>                        (marker.contains(&quot;ASPECTJ&quot;)) ||
<br>                        (marker.contains(&quot;SOAP&quot;)))
<br>                  &lt;/expression&gt;
<br>            &lt;/evaluator&gt;
<br>            &lt;onMatch&gt;DENY&lt;/onMatch&gt;
<br>        &lt;/filter&gt;
<br>        &lt;discriminator&gt;
<br>            &lt;Key&gt;code&lt;/Key&gt;
<br>             &lt;DefaultValue&gt;0000&lt;/DefaultValue&gt;
<br>          &lt;/discriminator&gt;
<br>          &lt;sift&gt;
<br>            &lt;appender name=&quot;FILE-${code}&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;
<br>                &lt;prudent&gt;${prudent}&lt;/prudent&gt;
<br> <br>                &lt;!-- 5 líneas de stacktrace para las excepciones --&gt;
<br>                &lt;encoder class=&quot;ch.qos.logback.classic.encoder.PatternLayoutEncoder&quot;&gt;
<br>                    &lt;Pattern&gt;%date - [%thread] - %.-20M - %L - cn=%contextName - [%thread] - [%X{code}] - %message%n %exception{5}&lt;/Pattern&gt;
<br>                &lt;/encoder&gt;
<br> <br>                &lt;rollingPolicy class=&quot;ch.qos.logback.core.rolling.TimeBasedRollingPolicy&quot;&gt;
<br>                    &lt;FileNamePattern&gt;${USER_HOME}/${backupDir}${code}.%d${patronRolling}&lt;/FileNamePattern&gt;  
<br>                    &lt;MaxHistory&gt;${maxHistory}&lt;/MaxHistory&gt; 
<br>                &lt;/rollingPolicy&gt;
<br>             &lt;/appender&gt;
<br>      &lt;/sift&gt;
<br>   &lt;/appender&gt;<br clear="all"><br><br>ASPECTJ and SOAP are Markers of other traces, that i don&#39;t want to see here. This way i get<br><br>in my root log directory ${USER_HOME}/${backupDir} files like<br><br>
0001.log<br>0002.log<br><br>But, now i have multile apps (wars and ejbs) where i use<br><br>web.xml<br><br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
<br>&lt;web-app xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot; xmlns=&quot;<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a>&quot; xmlns:web=&quot;<a href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a>&quot; xsi:schemaLocation=&quot;<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a> <a href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a>&quot; id=&quot;WebApp_ID&quot; version=&quot;2.5&quot;&gt;
<br>    ...<br>    
<br>    &lt;env-entry&gt;
<br>        &lt;description&gt;JNDI logging context for this app&lt;/description&gt;
<br>        &lt;env-entry-name&gt;logback/context-name&lt;/env-entry-name&gt;
<br>        &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt;
<br>        &lt;env-entry-value&gt;APP1&lt;/env-entry-value&gt;
<br>    &lt;/env-entry&gt;
<br>    &lt;env-entry&gt;
<br>        &lt;description&gt;URL for configuring logback context&lt;/description&gt;
<br>        &lt;env-entry-name&gt;logback/configuration-resource&lt;/env-entry-name&gt;
<br>        &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt;
<br>        &lt;env-entry-value&gt;logback.xml&lt;/env-entry-value&gt;
<br>    &lt;/env-entry&gt;      <br><br>    ...
<br>    
<br>&lt;/web-app&gt;<br><br><br><br>ejb-jar.xml<br><br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE ejb-jar PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN&quot; &quot;<a href="http://java.sun.com/dtd/ejb-jar_2_0.dtd">http://java.sun.com/dtd/ejb-jar_2_0.dtd</a>&quot;&gt;<br>
&lt;ejb-jar&gt;<br>    &lt;enterprise-beans&gt;<br>        &lt;session&gt;<br>            ...<br>            <br>            &lt;env-entry&gt;<br>                &lt;description&gt;JNDI logging context for this app&lt;/description&gt;<br>
                &lt;env-entry-name&gt;logback/context-name&lt;/env-entry-name&gt;<br>                &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt;<br>                &lt;env-entry-value&gt;EJB1&lt;/env-entry-value&gt;<br>
            &lt;/env-entry&gt;<br>            &lt;env-entry&gt;<br>                &lt;description&gt;URL for configuring logback context&lt;/description&gt;<br>                &lt;env-entry-name&gt;logback/configuration-resource&lt;/env-entry-name&gt;<br>
                &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt;<br>                &lt;env-entry-value&gt;logback.xml&lt;/env-entry-value&gt;<br>            &lt;/env-entry&gt;                <br><br>            ...            <br>
        &lt;/session&gt;<br>    &lt;/enterprise-beans&gt;<br><br>    ...<br>&lt;/ejb-jar&gt;<br><br>a env-entry to identificate. I know that insede file, i use cn=%contextName to see this context but...<br><br>How could i use this context like i use ${code} to separete this files (0001.log, 0002.log) in diferents directories.<br>
<br>Thanks.<br><br>-- <br>Jose Juan Montiel Martinez<br>Eurobits Technologies<br>Calle Musgo 3, 1ª Planta<br>28023 Madrid<br>T +34-917080300<br>F +34-913077480<br><a href="mailto:josejuan.montiel@eurobits.es">josejuan.montiel@eurobits.es</a><br>
<a href="http://www.eurobits.com">http://www.eurobits.com</a><br>