
If you have ContextJNDISelector as discussed previously, you must use prudent mode. With ContextJNDISelector , prudent mode is not optional but mandatory. You could abandon ContextJNDISelector and replace it with a servlet filter which inserts the name of the application into the MDC. An even better solution would be to write a custom converter, say JNDIPropertyConverter which would lookup the application name from JNDI and output the value found. See the docs on creating a custom converter [1] for details. From what we discussed thus far, I think JNDIPropertyConverter is your best bet yet. [1] http://logback.qos.ch/manual/layouts.html#customConversionSpecifier -- Ceki http://twitter.com/#!/ceki On 03/11/2011 10:23 PM, Scott Dudley wrote:
I'm using FixedWindowRollingPolicy and the doc says that prudent mode isn't supported with FixedWindowRollingPolicy (http://logback.qos.ch/manual/appenders.html#RollingFileAppender).
On 11/03/2011 02:11 PM, ceki wrote:
On 03/11/2011 10:07 PM, ceki wrote:
On 03/11/2011 10:02 PM, Scott Dudley wrote:
So clarify for me...
If I have only one set of classes loaded by the servlet engine (Tomcat) and only one logback.xml file shared among all applications, how do I have multiple appenders?
Sorry, you are right. If logback is loaded only once, then each appender mentioned in the config file will be loaded once. No need for prudent mode in this case.
Stupid me. ContextJNDISelector will cause logback-classic to be loaded multiple times. If the logback-classic instances share the same config file, then you will have multiple appender instances writing to the same file => prudent mode needs to be enabled.
-- Scott Dudley Senior Developer