[logback-user] Can logging configuration files be separated when using ContextJNDISelector?

ceki ceki at qos.ch
Wed Mar 20 20:56:08 CET 2013


Hi Ville,

It has been 3 full years since I've looked at
JNDIBasedContextDiscriminator [1]. Looking at it again it lools like
JNDIBasedContextDiscriminator code supposes that ContextJNDISelector
has been previously installed and that there is only a single
configuraton file for all applications. Have you installed
ContextJNDISelector?

Note that SiftingAppender could propbably fulfill the requirements of
your use case with only a single logback configuration file without
installing ContextJNDISelector. However, for that to work
JNDIBasedContextDiscriminator would need to be (renamed and) modified
to retreive its discriminating value directly from JNDI, something
which is not hard to do.

HTH,

[1] http://goo.gl/BW3NA

On 20.03.2013 19:29, Ville Hägg wrote:
> Hi all,
>
> I need to clarify if I have understood logging separation correctly.
>
> I have almost the same scenario than described e.g. in this question:
> http://mailman.qos.ch/pipermail/logback-user/2010-March/001442.html. In
> my environment I have most of the application logic deployed to JBoss 7
> as a JBoss module. Module have my shared libraries for common parts of
> the application as well as third party libraries (like Logback and
> Spring). My own custom shared implementations are using logging in a
> standard way by instantiating loggers as a static class variables.
>
> I am also having two war-applications which are using module described.
> Requirement is to have own logging context for each of the application.
> Which means applications should have their own log files, log levels and
> root loggers etc. I have tried to introduce
> JNDIBasedContextDiscriminator together with ShiftingAppender with no
> luck. My problem is that after my applications are initialized, it seems
> both of them is somehow sharing the same appenders. If I view status
> messages servlet, I can see that application B have initialized also
> RollingFileAppenders configured in application A's configuration file or
> other way round. RollingFileAppenders are wrapped inside SiftingAppender
> in both configuration files.
>
> Can anyone clarify to me can two applications using shared libraries
> have strictly separated configuration files which are introducing own
> loggers, appenders and logging levels? Or do I still have some kind of
> configuration problem with my setup?
>
> Thanks a lot,
> Ville

-- 
Ceki
65% of statistics are made up on the spot


More information about the Logback-user mailing list