Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2768

LogBuilder multi-parameter overloads

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.13.0
    • 2.13.1
    • API
    • None

    Description

      The new LogBuilder interface provides a single log(String format, Object... params) method for creating formatted messages from a String. The Logger methods info, debug, etc all had overloads like debug(String format, Object p0), debug(String format, Object p0, Object p1), etc. This avoided allocating an Object[] before knowing whether or not the message is going to be logged.

      Were these overloads intentionally omitted from the LogBuilder API? Is there a new/better way to avoid the Object[] allocation, or do newer JVMs perhaps not require this anymore?

      If not, I'd like to request the overloads be added to the LogBuilder API, and would be happy to submit a PR to do so.

      Google's Flogger has a write up that covers this topic in a bit more detail: https://google.github.io/flogger/anatomy

      Attachments

        Issue Links

          Activity

            People

              rgoers Ralph Goers
              mariusvolkhart Marius Volkhart
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m