Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4635817

Attaching handlers to loggers using logging config file

XMLWordPrintable



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

            caustinsunw Calvin Austin (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: