United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4635817 : Attaching handlers to loggers using logging config file

Details
Type:
Enhancement
Submit Date:
2002-02-10
Status:
Resolved
Updated Date:
2003-09-02
Project Name:
JDK
Resolved Date:
2003-09-02
Component:
core-libs
OS:
windows_nt
Sub-Component:
java.util.logging
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
5.0 (tiger)

Related Reports

Sub Tasks

Description

Name: gm110360			Date: 02/09/2002


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) 
======================================================================

                                    

Comments
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
 
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b18


                                     
2004-06-14



Hardware and Software, Engineered to Work Together