logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (LOG4J2-49) double message formatting w/SLF4JLogger
Date Sun, 18 Sep 2011 03:29:08 GMT

     [ https://issues.apache.org/jira/browse/LOG4J2-49?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Ralph Goers resolved LOG4J2-49.

    Resolution: Fixed
      Assignee: Ralph Goers

This really should have been opened as two separate Jira issues.

You have identified two problems:
1. SLF4J's XLogger formats twice when one of the parameters contains "{}".  I tested this
with Logback (which I would consider to be the reference implementation for SLF4J) and it
behaves more or less the same way. There was an issue regarding the "[" and "]" being inserted
but after fixing the second item below the same output as Logback is logged.
2. SLF4J's jcl-over-sl4j is formatting incorrectly. I have corrected this. 

> double message formatting w/SLF4JLogger
> ---------------------------------------
>                 Key: LOG4J2-49
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-49
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API
>            Reporter: John Vasileff
>            Assignee: Ralph Goers
> SLF4JLogger implements LocationAwareLogger which has
> public void log(Marker marker, String fqcn, int level, String message, Object[] argArray,
Throwable t);
> Callers of this method format the message in advance.  But SLF4JLogger also performs
> Example:
> slf4jLogger.info("slf4jLogger {}", "is formated twice? <{}>"); // works
> slf4jXlogger.info("slf4jXLogger {}", "is formated twice? <{}>"); // fails
> log4j2Logger.info("log4j2Logger shouldn't format <{}>"); // works
> jclOverSlf4jLogger.info("jclOverSlf4jLogger shouldn't format <{}>"); // fails
> Output:
> INFO Log4j2Testing [main] slf4jLogger is formated twice? <{}>
> INFO Log4j2Testing [main] slf4jXLogger is formated twice? <[[is formated twice? <{}>],
> INFO Log4j2Testing [main] log4j2Logger shouldn't format <{}>
> INFO Log4j2Testing [main] jclOverSlf4jLogger shouldn't format <[null, null]>

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


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

View raw message