[logback-user] Can we have more then one varable in file name

David Roussel nabble at diroussel.xsmail.com
Thu May 30 10:35:34 CEST 2013


Praveen,

I think sifting appender can only use one key from the MDC in the file name. 

It would be nice to use more, but that would require changes in logback. In fact I've wanted to do this before. But made a work around with two sifting appender and a filter. 

David

On 30 May 2013, at 10:28, praveen patil <iampraveenpatil at gmail.com> wrote:

> Hi everyone 
> 
> I am setting two variable in MDC and then in my appender in file tag i gave two variable ${configId} and ${threadName}. but when i run it i get only threadName value and for ${configId} it shows configId is UNDEFIND. but when the mdc context i found it is in the context, then why it giving error.
> 
> <appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
>         <discriminator class="com.hotwaxmedia.logger.ThreadNameBasedDiscriminator"/>
>         <sift>
>             <appender class="ch.qos.logback.core.FileAppender">
>                 <file>runtime/logs/DataManagerLog/${configId}-${threadName}.html</file>
>                 <layout class="ch.qos.logback.classic.PatternLayout">
>                     <pattern><div class="%p">%d \(${threadName} -%X{configId}\) [%logger{0} : %-5level] %msg%n%rEx</div></pattern>
>                 </layout>
>             </appender>
>         </sift>
>     </appender>
> 
> please help.
> 
> Praveen
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user


More information about the Logback-user mailing list