[logback-user] conversionRule for the File tag and the fileNamePattern

Marco Sousa marcomsousa at gmail.com
Tue Oct 18 11:37:33 CEST 2011


Hi there.

I want to set the filename of the file in the appender dynamic constructed
by conversionRule (ClassicConverter).
Because the filename is depending the %logger.
Converter:
 if (event.getLoggerName().contains(NEGOCIO)) {
StackTraceElement st= event.getCallerData()[0];
 filename = st.getClassName();
filename = filename.substring(NEGOCIO.length());
 int endIndex = filename.indexOf(".");
filename = filename.substring(0, endIndex);
 } else {
filename = event.getLoggerName();
    int endIndex = filename.indexOf(".");
    filename = filename.substring(0, endIndex);
}
return filename;

But the ConversionRule only work for the encoder pattern tag. So how to make
it work for file tag and the fileNamePattern tag.

I allready try with property but don't work.







-------------------------------------
Marco Sousa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20111018/7c629274/attachment.html>


More information about the Logback-user mailing list