Hello all,

I guess my problem is tricky enough to require help from developpers...

Logging works fine at the start of my App (.war), the .level declarations in logging.properties apply.

However, during initialisation, the App sets a <package>.level with by calling Logger.getLogger("<package>").setLevel(<some-level>),

the logging than gets inconsistent (not immediately) , for example  logger.info("....") generates a log even if a parent logger has been set to WARNING (level of logger not set).

I looked at the code of ClassLoaderLogManager and found two things that could explain, although I don't say I understand the problem.

 * private final Map<*ClassLoader*, ClassLoaderLogInfo>
   classLoaderLoggers = new *WeakHashMap*<>(); // Guarded by this

 * static ClassLoader getClassLoader() {
            ClassLoader result =
   *Thread.currentThread().getContextClassLoader()*;

What I noticed, is that following code

        java.util.logging.LogManager logM =java.util.logging.LogManager.getLogManager();  // it's a Tomcat ClassLoaderLogManager
        java.util.Enumeration<String> all = logM.getLoggerNames();

gives me changing results (and ClassLoaderLogInfo objects get garbage collected); previously done loglevel settings get lost.

Of course, this happens without "redeploying the .war".

To mention, the App implements it's own plugin management, setting a specific classloader for each plugin.

Any help is welcome,

Jacques



Reply via email to