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

Remko Popma commented on LOG4J2-1353:
-------------------------------------

Not sure that I agree that this is a programming error. I can see myself 
logging like this:

{code}
logger.debug("Calculation with", value1, "when in state", this.currentState, 
"gave result:", result);
{code}

I was a bit surprised at the [performance 
difference|https://issues.apache.org/jira/browse/LOG4J2-1278?focusedCommentId=15216236&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15216236]
 between logging a simple string and parameterized messages and have been 
thinking about alternatives. The above does not require API changes and since 
there are no parameter placeholders this would simply be a loop over the 
parameters to call StringBuilder.append, and may actually be faster.

> Logger 'Object... params' arguments should always be appended even if {} is 
> missing
> -----------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1353
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1353
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: API
>    Affects Versions: 2.5
>            Reporter: Alex Berg
>            Priority: Minor
>
> The Logger.warn/info/trace etc. has methods that take ... object list. It 
> maps into message where {} is given. If there are fewer {} than arguments in 
> list, it ignores argument. Who would ever desire to have an argument ignored? 
> That is to me clearly a bug in the design, but of cause I may be missing 
> something.
> I suggest to always append the unmatched extra arguments and separate them by 
> a space or a comma. I'm not sure if the last argument is logged as an 
> exception if it is an exception, in that case the solution should gracefully 
> handle that.
> A super nice feature would be if it was possible to configure the append of 
> the unmatched arguments, but I think that is more work than it is worth.
> see http://logging.apache.org/log4j/2.x/log4j-api/apidocs/index.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to