Bug 39627 - JULI ignores a ".level = XXX" directive in logging.properties
Summary: JULI ignores a ".level = XXX" directive in logging.properties
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.17
Hardware: PC All
: P3 minor (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2006-05-21 22:05 UTC by Richard Fearn
Modified: 2007-03-09 14:42 UTC (History)
1 user (show)

proposed fix for defect 39627 (1.02 KB, patch)
2006-06-08 14:59 UTC, Roger Keays
Details | Diff
Proposed fix for bug 39627 (Tomcat 5.5) (1.00 KB, patch)
2007-01-06 15:26 UTC, Richard Fearn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Fearn 2006-05-21 22:05:55 UTC
When using the standard Java Logging API (e.g. in a standalone Java program,
outside of Tomcat), the logging.properties file can have a directive such as

  .level = FINE

which will set the threshold for the root logger. Assuming in this case that the
handlers associated with the root logger also have a threshold of FINE (or
lower), then FINE log messages passed to the root logger will be output by the
handlers (e.g. to the console, or to a file).

When using JULI, the ".level = XXX" directive is ignored. The default logging
configuration for Tomcat sets the threshold for the root logger's handlers
(1catalina.org.apache.juli.FileHandler and java.util.logging.ConsoleHandler) to
FINE, so putting ".level = ALL" should be enough to get all FINE (and CONFIG)
log messages sent to the console and log files.

It doesn't work if JULI is used directly:

Logger log = Logger.getLogger("name");
log.fine("Some message");

It also doesn't work if Commons Logging is used (since the Jdk14Logger just
delegates the logging to a Java Logging Logger object - Commong Logging "debug"
is translated into Java Logging "FINE"):

Log log = LogFactory.get("name");
log.debug("Some message");

The workaround for this is to explicitly give a threshold for a lower-level
(package-level, for example) logger, and explicitly list the default handlers
for this logger. For example:

my.logger.level = FINE
my.logger.handlers = 1catalina.org.apache.juli.FileHandler,
Comment 1 Roger Keays 2006-06-08 14:57:54 UTC
Hey Richard,

I've been bitten by this defect too. AFAICT it is caused by juli's LogManager
adding the root logger directly to the classloaders map of loggers, instead of
using the addLogger() method which performs some configuration.

Here's a patch to the juli source on the 6.0.x tree. It seems to work okay for
me, but I can see from reading the code that there are other defects with the
way logging configuration is inherited from classloader to classloader and the
way configuration is reset. This might solve your problem though.

Comment 2 Roger Keays 2006-06-08 14:59:44 UTC
Created attachment 18430 [details]
proposed fix for defect 39627

patch added
Comment 3 Sebastian Davids 2007-01-04 17:04:52 UTC
Any chance to see this in Tomcat 5.5.21 or Tomcat 6.0.x?
Comment 4 Richard Fearn 2007-01-06 12:55:30 UTC
Hi Sebastian,

> Any chance to see this in Tomcat 5.5.21 or Tomcat 6.0.x?

I'm not sure if you're asking whether the bug is still present in these
versions, or if it's fixed in these versions.

I've just tested Tomcat 5.5.20 (the latest 5.5 release) and 6.0.7. The bug is
still present in 5.5.20, but is fixed in 6.0.7.
Comment 5 Richard Fearn 2007-01-06 13:36:45 UTC
Tomcat 6.0.x uses its own version of JULI. Remy Maucherat checked in Roger's
patch in July 2006:


Tomcat 5.5.x must still use the old version of JULI:

Comment 6 Richard Fearn 2007-01-06 15:26:53 UTC
Created attachment 19370 [details]
Proposed fix for bug 39627 (Tomcat 5.5)

This is an equivalent patch for Tomcat 5.5. It's the same as the 6.0 patch
(except I've just removed the info.loggers.put line, instead of commenting it

I've tested this with Tomcat 5.5.20 and it fixes the bug.

The change to the 6.0 JULI code was made well before 6.0 alpha/beta releases
started to be produced, so this has actually been fixed since 6.0.0.
Comment 7 Richard Fearn 2007-01-06 15:44:05 UTC
To clarify, this new patch should be applied to the Tomcat Connectors project
found here:

Comment 8 Richard Fearn 2007-01-12 03:11:33 UTC
Changing back to 5.5.17 (the earliest known version with this bug).
Comment 9 Mark Thomas 2007-01-14 08:03:20 UTC
This has been fixed in svn for 5.5.x and will be in 5.5.21 onwards.
Comment 10 Richard Fearn 2007-02-24 08:07:44 UTC
Fixed in 5.5.22.
Comment 11 Richard Fearn 2007-03-09 14:42:23 UTC
5.5.22 wasn't released so this is fixed in 5.5.23.