Log4j 2
  1. Log4j 2
  2. LOG4J2-16

Provide support for SLF4J type Markers

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-alpha1
    • Component/s: Core
    • Labels:
      None

      Description

      We wrote our own logging framework primarily because log4j didn't provide some of the features we needed. One feature was more granularity, especially around logging. We encourage entry and exit tracing, logging of input and output data, logging of elapsed time statistics and several other flavors if "debug" information. Turning all this on in production generates too much data. Our framework supported the concept of Log Type in addition to Log Level. When filtering there was a LogType array where each array element was the log level. The LogRecord contained the LogType and LogLevel so doing filtering was very fast.

      SLF4J supports Markers. These can essentially be used for the same purpose (assuming another Jira issue regarding filtering is implemented). Markers are much more flexible since they can be arbitrarily created. Loggers should then be able to filter on whether a marker is present in addition to the LogLevel.

        Issue Links

          Activity

          Hide
          Paul Smith added a comment -

          This concept should also include leverage of both dynamic markers (during configuration, or even runtime), and static compile-time markers (say, via Annotations).

          Show
          Paul Smith added a comment - This concept should also include leverage of both dynamic markers (during configuration, or even runtime), and static compile-time markers (say, via Annotations).
          Hide
          Curt Arnold added a comment -

          I think that this can fit into the "context" concept which is an open ended place for either explicitly supplied context (like markers would seem to be) or implicit context (such as thread name, MDC and NDC content, user) that are collected from the environment.

          Not sure how well I described that in the pattern-layout code.

          Show
          Curt Arnold added a comment - I think that this can fit into the "context" concept which is an open ended place for either explicitly supplied context (like markers would seem to be) or implicit context (such as thread name, MDC and NDC content, user) that are collected from the environment. Not sure how well I described that in the pattern-layout code.
          Hide
          Paul Smith added a comment -

          I like the terminology 'context' and how you mention it relates to things like MDC, and Thread etc.

          Show
          Paul Smith added a comment - I like the terminology 'context' and how you mention it relates to things like MDC, and Thread etc.
          Hide
          Ralph Goers added a comment -

          Curt added a "doubt" comment to Logger that said I'd prefer an abstract user context object over Marker. You could still use a Marker as your user context object, but you could also use an HttpServletRequest or any other context object."

          Markers are cheap and fast to filter on but provide a fairly flexible way to segregate logging events.

          When you have an alternative to review please update this issue.

          Show
          Ralph Goers added a comment - Curt added a "doubt" comment to Logger that said I'd prefer an abstract user context object over Marker. You could still use a Marker as your user context object, but you could also use an HttpServletRequest or any other context object." Markers are cheap and fast to filter on but provide a fairly flexible way to segregate logging events. When you have an alternative to review please update this issue.
          Hide
          Ralph Goers added a comment -

          Although Markers are part of 2.0-alpha1 I'm leaving this open in case someone wants to implement one of the other techniques mentioned.

          Show
          Ralph Goers added a comment - Although Markers are part of 2.0-alpha1 I'm leaving this open in case someone wants to implement one of the other techniques mentioned.
          Hide
          Ralph Goers added a comment -

          Closing this issue as there have been no further comments. If someone wants to implement one of the alternatives then a new issue can be created that describes it.

          Show
          Ralph Goers added a comment - Closing this issue as there have been no further comments. If someone wants to implement one of the alternatives then a new issue can be created that describes it.

            People

            • Assignee:
              Unassigned
              Reporter:
              Ralph Goers
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development