[ 
https://issues.apache.org/jira/browse/LOG4J2-2768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17033074#comment-17033074
 ] 

ASF subversion and git services commented on LOG4J2-2768:
---------------------------------------------------------

Commit 6913465c030ce02b3d6abb5a11b31f5f392f6b2a in logging-log4j2's branch 
refs/heads/master from Marius Volkhart
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=6913465 ]

LOG4J2-2768 Add log(String, ...) overloads to LogBuilder (#336)

* LOG4J2-2768 Add log(String, ...) overloads to LogBuilder

The overloaded methods behave similarly to log(String, Object[]), but reduce 
the need for an Object[] allocation in certain code paths. The added methods 
and their Javadoc come from the Logger class. The Javadoc have been modified 
with the additional of the @see reference to the Unbox class. The Unbox class 
did not exist when the Logger Javadoc were originally written, and it seems 
pertinent to make users aware of the performance benefit when using these 
methods.

* Add Javadoc to LogBuilder.log(String, Object[])

This Javadoc matches the format of the other log(String, ...) overloads.


> LogBuilder multi-parameter overloads
> ------------------------------------
>
>                 Key: LOG4J2-2768
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2768
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.13.0
>            Reporter: Marius Volkhart
>            Assignee: Ralph Goers
>            Priority: Minor
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> 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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to