Uploaded image for project: 'Commons Logging'
  1. Commons Logging
  2. LOGGING-98

[logging][PATCH] Improvements to LogFactoryImpl

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.1.0
    • None
    • Operating System: other
      Platform: Other

    • 34661

    Description

      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
      list.

      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
      java.util.logging.

      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.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            b_stansberry@hotmail.com Brian Stansberry
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: