Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-347

Inconsistent use of singleton pattern in Binder classes

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.x
    • Fix Version/s: 1.7.14
    • Component/s: Core API
    • Labels:
      None

      Description

      Can somebody please explain why StaticMarkerBinder and StaticMDCBinder implement the singleton pattern using a public field, whereas StaticLoggerBinder has a private field and a public getter method?

      I'm working on making a Clojure logging framework compatible with SLF4J, and this reliance of StaticMarkerBinder and StaticMDCBinder on public fields rather than getters is causing problems because Clojure, being functional, does not allow us to expose public fields in classes - only methods.

      It looks like StaticMarkerBinder.SINGLETON is only referenced here, and StaticMDCBinder.SINGLETON is only referenced here. Is there a technical reason why these access the fields directly, or is it just the result of an early decision being frozen into the API?

      Many thanks

        Attachments

          Activity

            People

            • Assignee:
              slf4j-dev SLF4J developers list
              Reporter:
              rufoa Rufus Andrews
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: