Log4j 2
  1. Log4j 2
  2. LOG4J2-151

Please facilitate subclassing Logger and LoggerContext (in org.apache.logging.log4j.core)

    Details

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

      Description

      I would like to create a custom logger, while reusing the org.apache.logging.log4j.core.Logger functionality.

      The following two changes would make subclassing possible:

      • change visibility of method Logger$PrivateConfig#logEvent(LogEvent) (line 265) from protected to public
      • change visibility of method LoggerContext#newInstance(LoggerContext, String) (line 310) from private to protected

      My use case is that I want to create an asynchronous Logger for low latency logging.
      This custom logger hands off control to a separate thread as early as possible. In my case, AsynchAppender is not a good match for my requirements, as with that approach (a) the logging call still needs to flow down the hierarchy to the appender, doing synchronization and creating objects at various points on the way, and (b) when serializing the LogEvent, the getSource() method is always called, which is expensive.

      1. FastLog4j.zip
        551 kB
        Remko Popma
      2. FastLog4j-v2-for-beta4.zip
        226 kB
        Remko Popma
      3. LOG4J2-151-patch-Logger.txt
        0.7 kB
        Remko Popma
      4. LOG4J2-151-patch-LoggerContext.txt
        0.7 kB
        Remko Popma

        Issue Links

          Activity

          Remko Popma created issue -
          Remko Popma made changes -
          Field Original Value New Value
          Affects Version/s 2.0-beta3 [ 12323368 ]
          Remko Popma made changes -
          Affects Version/s 2.0-beta2 [ 12323283 ]
          Remko Popma made changes -
          Attachment FastLog4j.zip [ 12565637 ]
          Remko Popma made changes -
          Link This issue relates to LOG4J2-153 [ LOG4J2-153 ]
          Remko Popma made changes -
          Link This issue relates to LOG4J2-154 [ LOG4J2-154 ]
          Remko Popma made changes -
          Link This issue depends upon LOG4J2-157 [ LOG4J2-157 ]
          Remko Popma made changes -
          Attachment LOG4J2-151-patch-Logger.txt [ 12566770 ]
          Attachment LOG4J2-151-patch-LoggerContext.txt [ 12566771 ]
          Remko Popma made changes -
          Attachment FastLog4j-v2-for-beta4.zip [ 12566774 ]
          Remko Popma made changes -
          Link This issue blocks LOG4J2-163 [ LOG4J2-163 ]
          Ralph Goers made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Ralph Goers [ ralph.goers@dslextreme.com ]
          Fix Version/s 2.0-beta5 [ 12323970 ]
          Resolution Fixed [ 1 ]
          Remko Popma made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Link This issue blocks LOG4J2-163 [ LOG4J2-163 ]
          Gavin made changes -
          Link This issue is depended upon by LOG4J2-163 [ LOG4J2-163 ]

            People

            • Assignee:
              Ralph Goers
              Reporter:
              Remko Popma
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development