Hi, again with another question.<br><br>With aspectj, in injecting a var in MCD, something like this...<br><br>MDC.put("code",var);<br><br>in some places, depending something, and i'm using this to generate a diferent file for this something like<br>
<br> <appender name="APPENDER" class="ch.qos.logback.classic.sift.SiftingAppender">
<br> <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<br> <evaluator class="ch.qos.logback.classic.boolex.JaninoEventEvaluator">
<br> <expression>
<br> (marker != null)
<br> &amp;&amp; (
<br> (marker.contains("ASPECTJ")) ||
<br> (marker.contains("SOAP")))
<br> </expression>
<br> </evaluator>
<br> <onMatch>DENY</onMatch>
<br> </filter>
<br> <discriminator>
<br> <Key>code</Key>
<br> <DefaultValue>0000</DefaultValue>
<br> </discriminator>
<br> <sift>
<br> <appender name="FILE-${code}" class="ch.qos.logback.core.rolling.RollingFileAppender">
<br> <prudent>${prudent}</prudent>
<br> <br> <!-- 5 líneas de stacktrace para las excepciones -->
<br> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<br> <Pattern>%date - [%thread] - %.-20M - %L - cn=%contextName - [%thread] - [%X{code}] - %message%n %exception{5}</Pattern>
<br> </encoder>
<br> <br> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<br> <FileNamePattern>${USER_HOME}/${backupDir}${code}.%d${patronRolling}</FileNamePattern>
<br> <MaxHistory>${maxHistory}</MaxHistory>
<br> </rollingPolicy>
<br> </appender>
<br> </sift>
<br> </appender><br clear="all"><br><br>ASPECTJ and SOAP are Markers of other traces, that i don'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><?xml version="1.0" encoding="UTF-8"?>
<br><web-app xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xmlns="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a>" xmlns:web="<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>" xsi:schemaLocation="<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>" id="WebApp_ID" version="2.5">
<br> ...<br>
<br> <env-entry>
<br> <description>JNDI logging context for this app</description>
<br> <env-entry-name>logback/context-name</env-entry-name>
<br> <env-entry-type>java.lang.String</env-entry-type>
<br> <env-entry-value>APP1</env-entry-value>
<br> </env-entry>
<br> <env-entry>
<br> <description>URL for configuring logback context</description>
<br> <env-entry-name>logback/configuration-resource</env-entry-name>
<br> <env-entry-type>java.lang.String</env-entry-type>
<br> <env-entry-value>logback.xml</env-entry-value>
<br> </env-entry> <br><br> ...
<br>
<br></web-app><br><br><br><br>ejb-jar.xml<br><br><?xml version="1.0" encoding="UTF-8"?><br><!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "<a href="http://java.sun.com/dtd/ejb-jar_2_0.dtd">http://java.sun.com/dtd/ejb-jar_2_0.dtd</a>"><br>
<ejb-jar><br> <enterprise-beans><br> <session><br> ...<br> <br> <env-entry><br> <description>JNDI logging context for this app</description><br>
<env-entry-name>logback/context-name</env-entry-name><br> <env-entry-type>java.lang.String</env-entry-type><br> <env-entry-value>EJB1</env-entry-value><br>
</env-entry><br> <env-entry><br> <description>URL for configuring logback context</description><br> <env-entry-name>logback/configuration-resource</env-entry-name><br>
<env-entry-type>java.lang.String</env-entry-type><br> <env-entry-value>logback.xml</env-entry-value><br> </env-entry> <br><br> ... <br>
</session><br> </enterprise-beans><br><br> ...<br></ejb-jar><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>