Hi,<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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<br>
diferent file for this something like<br>
<br>
<appender name="APPENDER"<br>
class="ch.qos.logback.classic.sift.SiftingAppender"><br>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter"><br>
<evaluator<br>
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}"<br>
class="ch.qos.logback.core.rolling.RollingFileAppender"><br>
<prudent>${prudent}</prudent><br>
<br>
<!-- 5 l?neas de stacktrace para las excepciones --><br>
<encoder<br>
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"><br>
<Pattern>%date - [%thread] - %.-20M - %L -<br>
cn=%contextName - [%thread] - [%X{code}] - %message%n<br>
%exception{5}</Pattern><br>
</encoder><br>
<br>
<rollingPolicy<br>
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><br>
<br>
<FileNamePattern>${USER_HOME}/${backupDir}${code}.%d${patronRolling}</FileNamePattern><br>
<br>
<MaxHistory>${maxHistory}</MaxHistory><br>
</rollingPolicy><br>
</appender><br>
</sift><br>
</appender><br>
<br>
<br>
ASPECTJ and SOAP are Markers of other traces, that i don't want to see here.<br>
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" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>" xmlns="<br>
<a href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a>" xmlns:web="<br>
<a href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" target="_blank">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a>" xsi:schemaLocation="<br>
<a href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a><br>
<a href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" target="_blank">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a>" id="WebApp_ID"<br>
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<br>
JavaBeans 2.0//EN" "<a href="http://java.sun.com/dtd/ejb-jar_2_0.dtd" target="_blank">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<br>
context</description><br>
<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<br>
to see this context but...<br>
<br>
How could i use this context like i use ${code} to separete this files<br>
(0001.log, 0002.log) in diferents directories.<br>
<br></blockquote><br>I'll make more simple... how to mix<br><br><discriminator class="ch.qos.logback.classic.sift.JNDIBasedContextDiscriminator">
<br> <defaultValue>unknown</defaultValue>
<br></discriminator><br><br>and <br><br><discriminator>
<br> <Key>code</Key>
<br> <DefaultValue>0000</DefaultValue>
<br></discriminator><br><br>this is a MDC, form use %code (inside log line) like ${contextName} in name file.<br><br>Can i have 2 discriminator inside 1 appender?<br><br>PD: logback version 0.9.21.<br><br>Thanks.<br>
<br></div>-- <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>