You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Ruslan Gainutdinov <ru...@gmail.com> on 2010/05/11 18:52:33 UTC

WebappClassLoader.clearReferences removes root Java Logger handlers

Hello!

I am using apache-tomcat-6.0.26 with Tanuki Wrapper.

In this particular setup, Juli is not used (no
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager) and
java.util.logging.LogManager returns standard Java SE instance.

org.apache.catalina.loader.WebappClassLoader.clearReferences() calls Juli
org.apache.juli.logging.LogFactory.release() which in turn
issues
LogManager.getLogManager().reset();

For Juli this, I suppose, means return to pristine state before any
changes have been done.
But for Java SE LogManager this REMOVES any handlers in root classloader.

This causes all logging to stop after such event as web application
redeployment.

I propose following change to Juli org.apache.juli.logging.LogFactory:

--- LogFactory.orig
+++ LogFactory.java
@@ -328,9 +328,11 @@
      */
     public static void release(
             @SuppressWarnings("unused") ClassLoader classLoader) {
+        if (LogManager.getLogManager() instanceof ClassLoaderLogManager) {
         // JULI's log manager looks at the current classLoader
         LogManager.getLogManager().reset();
+     }
    }

P.S. If needed, I can create bug in bugzilla.

With kindest personal regards,
Ruslan Gainutdinov
<ru...@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: WebappClassLoader.clearReferences removes root Java Logger handlers

Posted by Mark Thomas <ma...@apache.org>.
On 11/05/2010 18:52, Ruslan Gainutdinov wrote:
> Hello!
>
> I am using apache-tomcat-6.0.26 with Tanuki Wrapper.
>
> In this particular setup, Juli is not used (no
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager) and
> java.util.logging.LogManager returns standard Java SE instance.

This question belongs on the users list. Pretty much the exact same 
question was asked very recently. You could try searching the archives.

Mark

>
> org.apache.catalina.loader.WebappClassLoader.clearReferences() calls Juli
> org.apache.juli.logging.LogFactory.release() which in turn
> issues
> LogManager.getLogManager().reset();
>
> For Juli this, I suppose, means return to pristine state before any
> changes have been done.
> But for Java SE LogManager this REMOVES any handlers in root classloader.
>
> This causes all logging to stop after such event as web application
> redeployment.
>
> I propose following change to Juli org.apache.juli.logging.LogFactory:
>
> --- LogFactory.orig
> +++ LogFactory.java
> @@ -328,9 +328,11 @@
>        */
>       public static void release(
>               @SuppressWarnings("unused") ClassLoader classLoader) {
> +        if (LogManager.getLogManager() instanceof ClassLoaderLogManager) {
>           // JULI's log manager looks at the current classLoader
>           LogManager.getLogManager().reset();
> +     }
>      }
>
> P.S. If needed, I can create bug in bugzilla.
>
> With kindest personal regards,
> Ruslan Gainutdinov
> <ru...@gmail.com>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org