JDK-4635817 : Attaching handlers to loggers using logging config file
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2002-02-10
  • Updated: 2017-05-16
  • Resolved: 2003-09-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
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
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b18
14-06-2004

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
11-06-2004