tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lakmali Baminiwatta <lakmali8...@gmail.com>
Subject Clarification of Juli - ClassLoaderLogManager
Date Thu, 02 May 2013 11:44:29 GMT
Hi all,

I am using Tomcat Juli.

In org.apache.juli.ClassLoaderLogManager class, when reading the
configuration from the specified classLoaders through below method,

*readConfiguration(ClassLoader classLoader)*
*
*
*It checks whether the current classLoader and System Class Loader is same
before reading the global logging configuration file. *
*
*
 if ((is == null) && *(classLoader == ClassLoader.getSystemClassLoader()*))
{
            String configFileStr =
System.getProperty("java.util.logging.config.file");
            if (configFileStr != null) {
                try {
                    is = new FileInputStream(replace(configFileStr));
                } catch (IOException e) {
                    // Ignore
                }
            }
            // Try the default JVM configuration
            if (is == null) {
                File defaultFile = new File(new
File(System.getProperty("java.home"), "lib"),
                    "logging.properties");
                try {
                    is = new FileInputStream(defaultFile);
                } catch (IOException e) {
                    // Critical problem, do something ...
                }
            }
        }

I am really greatful if the reason why such a check [*classLoader ==
ClassLoader.getSystemClassLoader()*] is required, can be clarified?

I am asking this because, I have a scenario which this condition fails due
to unequality of the classLoaders. But removing that check fixed the issue
and logging happens as expected.

Appreciate if you can point me out the possibility of an issue with my
change or why that check is there.

Thanks,
Lakmali

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message