Commons Logging
  1. Commons Logging
  2. LOGGING-98

[logging][PATCH] Improvements to LogFactoryImpl


    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.0
    • Labels:
    • Environment:

      Operating System: other
      Platform: Other


      Attached is a draft version of a proposed rework of the LogFactoryImpl discovery
      mechanism. This work is based on recent discussions on the commons-dev mailing

      The prime difference between the proposal and the existing class is that when
      the new discovery process "discovers" a potential Log implementation, it
      immediately attempts to create a Log instance. Only if an instance is
      successfully created is the implementation consider "discovered." The existing
      LogFactoryImpl considers an Log implementation to be discovered if it can load
      its class, but if there are any subsequent problems actually instantiating an
      object, the discovery process is already over and the code has no choice but to
      throw an exception.

      This proposed approach allows implementation of a couple of ideas Robert Burrell
      Donkin proposed on the dev list:

      1) If discovery is able to load an implementation class using the TCCL, but
      instantiation fails, discovery continues with an attempt to load and instantiate
      the class using LogFactoryImpl's classloader.

      2) If an implementation cannot be instantiated, no exception is thrown, but
      rather discovery continues to try other implementations, beginning with

      In addition, the proposed code will write diagnostic messages to System.out and
      System.err if a Log class can be loaded but not instantiated. This is to help
      users understand why their desired Log implementation was not used. Some users
      may prefer to have JCL throw an exception. How this is handled could be made
      configurable; the proposed code at this point does not include this feature but
      it could be added.

      The intent of the attachment is to promote discussion/seek review, and since its
      a pretty significant refactor I've attached a complete file rather than a diff.
      To ease comparison the file includes a fair amount of commented out code from
      the prior version.

      Any comments or suggestions would be most appreciated.

      1. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl8c.diff
        6 kB
        Brian Stansberry
      2. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl7c.diff
        2 kB
        Brian Stansberry
      3. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl6a.diff
        1.0 kB
        Brian Stansberry
      4. ASF.LICENSE.NOT.GRANTED--LoadTest.diff
        1 kB
        Brian Stansberry
      5. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl5b.diff
        6 kB
        Brian Stansberry
      6. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl5a.diff
        33 kB
        Brian Stansberry
      7. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl4b.diff
        6 kB
        Brian Stansberry
      8. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl4a.diff
        32 kB
        Brian Stansberry
      9. ASF.LICENSE.NOT.GRANTED--LogFactoryImplD.diff
        3 kB
        Brian Stansberry
      10. ASF.LICENSE.NOT.GRANTED--LogFactoryImplC.diff
        5 kB
        Brian Stansberry
      11. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl.diff
        6 kB
        Brian Stansberry
      12. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl.diff
        32 kB
        Brian Stansberry
        39 kB
        Brian Stansberry
      14. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl4.diff
        38 kB
        Brian Stansberry
        22 kB
        Brian Stansberry
      16. ASF.LICENSE.NOT.GRANTED--LogFactoryImpl.diff
        15 kB
        Brian Stansberry
        25 kB
        Brian Stansberry



          • Assignee:
            Brian Stansberry
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: