|
Quick Lists
|
|
Bug ID:
|
4635817
|
|
Votes
|
1
|
|
Synopsis
|
Attaching handlers to loggers using logging config file
|
|
Category
|
java:classes_util_logging
|
|
Reported Against
|
merlin-rc1
|
|
Release Fixed
|
1.5(tiger)
|
|
State
|
10-Fix Delivered,
request for enhancement
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
|
|
Submit Date
|
10-FEB-2002
|
|
Description
|
FULL PRODUCT VERSION :
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)
FULL OPERATING SYSTEM VERSION :
Windows NT Version 4.0
A DESCRIPTION OF THE PROBLEM :
It seems that only global handlers (i.e. handlers attached
to the root logger) can be configured in the config file.
What about logger specific handlers? There should be a way
to attach handlers to non-root loggers without needing to
recompile anything (i.e. in the logging config file). For
example, what about using
aLogger.handler = <handler-class-name>
in the config file to specify handlers?
In addition, I could not find any consistent doc about the
attributes for loggers and hadlers that can be specified in
the logging config file. I understand that some of the
attributes can be handler specific, but the attributes
applicable to all loggers and handlers should be more
clearly documented.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. provide a list of handlers in the logging config file:
handlers=foo.bar.handler1,foo.bar.handler2
2. attach foo.bar.handler1 to foo.bar.logger1
foo.bar.logger1.handler=foo.bar.handler1
3. attach foo.bar.handler2 to foo.bar.logger2
foo.bar.logger2.handler=foo.bar.handler2
4. set all the handler and logger levels to Level.ALL to
avoid confusion with non-printed msgs
5. set (in code) the useParentHandlers of logger1 and
logger2 to false
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected result:
foo.bar.logger1 logs using foo.bar.handler1
foo.bar.logger2 logs using foo.bar.handler2
Actual result:
No log messages at all. If the property useParentHandlers
is set true, then the both logger log using both the
handlers (i.e the root logger's handler are used).
This bug can be reproduced always.
(Review ID: 138696)
======================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
Logger specific handlers are now available through the logging.properties file.
<logger name>.handlers=Handler1,Handlern
<logger name>.useParentHandlers=boolean
Handler1 and Handlern are class names for each Handler
|
|
Comments
|
Submitted On 13-FEB-2002
iston
Some modifications and additions to the original report...
The attribute to attach handlers to a logger in the config
file should be 'handlers' instead of 'handler' in order to
being able to associate multiple handlers to the logger.
Example:
aLogger.handlers = handler1,handler2,handler3
In addition, it would also be convenient to control the
inheritance of parent handlers in the config file. Example:
aLogger.useParentHandlers = <true or false>
Submitted On 20-DEC-2002
dlipp
This is an easy thing to do and would improve the flexibility of
the logging API by far.
Right now we had to implement our own parsing mechanism
to be able to treat such settings made in the config file.
We'd like to be able to configure all logging settings in the
config file!
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |