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

Ralph Goers commented on LOG4J2-1688:
-------------------------------------

Based on your test this is behaving correctly. In java an array is treated 
exactly the same as a variable argument list. In essence you called a method 
with a definition of method("format", Object... args);.  The format specified 
indicates how many arguments should be printed. You would get the exact same 
behavior if you called System.out.prinf("test %s", args), but not if you called 
System.out.printf("test %s", Arrays.toString(args));  If you really want to 
print the whole array then do

    log4jLogger.error("test {}", Arrays.toString(args));

> Multiple loggings of arguments are setting these arguments to null
> ------------------------------------------------------------------
>
>                 Key: LOG4J2-1688
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1688
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.7
>            Reporter: Stefan Hammelbeck
>
> We are using SLF4J over log4j Version 2.7.
> Calling {{org.slf4j.Logger.error(someFormat, args)}} *twice* with an 
> {{Object[] args}}  causes all elements of {{args}} to be set to {{null}}.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to