Tomasz Kowalczewski created LOG4J2-1055:
-------------------------------------------
Summary: Logger method overloads for multiple message formatting
params
Key: LOG4J2-1055
URL: https://issues.apache.org/jira/browse/LOG4J2-1055
Project: Log4j 2
Issue Type: Improvement
Components: API
Affects Versions: 2.3
Reporter: Tomasz Kowalczewski
Priority: Critical
When logging message with parameters Logger interface provide methods of the
form {debug/info/error}(Marker marker, String message, Object... params);
This means there will be an array of params created for each call. There should
be overrides that accept one param, two params etc.
SLF4J has such overrides and require explicit array creation if someone
provides too many params (there is no varargs version). If people use LOG4J2
under the covers they will be surprised that arrays are created for every call.
What is worse, people think that call of the form
LOGGER.debug("Message: {}", foobar);
when using SLF4J does not need to be wrapped in if(LEGGER.isDebugEnabled())
check as the API is specifically designed that there should be no object
allocation happening if the level is disabled. LOG4J2 breaks that promise.
This array creation is visible in our applications - it is not optimised away
by escape analysis.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]