Alexandre Gattiker created LOG4J2-632:
-----------------------------------------

             Summary: Formatter logger mixes up arguments
                 Key: LOG4J2-632
                 URL: https://issues.apache.org/jira/browse/LOG4J2-632
             Project: Log4j 2
          Issue Type: Bug
    Affects Versions: 2.0-rc1
            Reporter: Alexandre Gattiker


{code}

public class Example {

        private final static Logger FORMATTER_LOGGER = 
LogManager.getFormatterLogger(Example.class);

        public static void main(String[] args) {

                FORMATTER_LOGGER.log(ERROR, "It is %1s in %2s", new Date(), 
"Switzerland"); // works fine

                FORMATTER_LOGGER.log(ERROR, "It is %1$tF in %2s", new Date(), 
"Switzerland"); // ignores "Switzerland", uses %1 value instead

        }
}
{code}

{noformat}
13:53:21.350 [main] ERROR com.example.Example - It is Tue May 06 13:53:21 CEST 
2014 in Switzerland
13:53:21.355 [main] ERROR com.example.Example - It is 2014-05-06 in Tue May 06 
13:53:21 CEST 2014
{noformat}




--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
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