conversionRule for the File tag and the fileNamePattern

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

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

Hi, But sift only work with: AccessEventDiscriminator (Access) MDCBasedDiscriminator (MDC) ContextBasedDiscriminator, (context) JNDIBasedContextDiscriminator (Database) Don't have one to work with the classic variables(%) / conversionRule / .... ------------------------------------- Marco Sousa 2011/10/18 ceki <ceki@qos.ch>
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
______________________________**_________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>

Yes, but tou can write your own discriminator. It's just a few lines of code. On 18.10.2011 14:06, Marco Sousa wrote:
Hi,
But sift only work with:
AccessEventDiscriminator (Access) MDCBasedDiscriminator (MDC) ContextBasedDiscriminator, (context) JNDIBasedContextDiscriminator (Database)
Don't have one to work with the classic variables(%) / conversionRule / ....

Yes... it worked with a new discriminator:-) thanks a lot ------------------------------------- Marco Sousa 2011/10/18 ceki <ceki@qos.ch>
Yes, but tou can write your own discriminator. It's just a few lines of code.
On 18.10.2011 14:06, Marco Sousa wrote:
Hi,
But sift only work with:
AccessEventDiscriminator (Access) MDCBasedDiscriminator (MDC) ContextBasedDiscriminator, (context) JNDIBasedContextDiscriminator (Database)
Don't have one to work with the classic variables(%) / conversionRule / ....
______________________________**_________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
participants (2)
-
ceki
-
Marco Sousa