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

ceki ceki at qos.ch
Tue Oct 18 13:33:53 CEST 2011


Marco,

Have you looked at SiftingAppender?

Cheers,
--
Ceki
On 18.10.2011 11:37, Marco Sousa wrote:
> 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



More information about the Logback-user mailing list