You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Yogesh Rao (JIRA)" <ji...@apache.org> on 2014/08/24 16:29:37 UTC

[jira] [Commented] (LOG4J2-796) Log4J2 API not logging correct message with SL4J Simple Logger

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

Yogesh Rao commented on LOG4J2-796:
-----------------------------------

As per [~remkop@yahoo.com] 
"This looks like a bug. The output is the FQCN (fully qualified name of the
logger).
This is probably introduced by the changes made for LOG4J2-555.

Our unit tests are not picking this up because they use
the ch.qos.logback.classic.Logger, which is a LocationAwareLogger and
follows a different code path.
I suspect that Simple Logger is not LocationAware.

I suspect we should change (in SLF4JLogger.logMessage)
     logger.debug(fqcn, getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);
to
     logger.debug(getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);"

> Log4J2 API not logging correct message with SL4J Simple Logger
> --------------------------------------------------------------
>
>                 Key: LOG4J2-796
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-796
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API, SLF4J Bridge
>    Affects Versions: 2.0.1
>            Reporter: Yogesh Rao
>
> Hi,
> Log4j2 Fails to log the message provided correctly using the log4j-to-slf4j adaptor when the logging implementation used SLF4J-Simple.
> To reproduce the issue use following class and configuration
> HelloWorld.java 
> --------------
> import org.apache.logging.log4j.LogManager;
> import org.apache.logging.log4j.Logger;
> public class HelloWorld {
> 	private static final Logger logger = LogManager.getLogger("HelloWorld");
> 	
>     public static void main(String[] args) {
>         logger.error("Hello, World!");
>         logger.error("Logging in user {} with birthday {}", "Ted", "1/10/1900");
>     }
> }
> Jars in classpath
> ----------------------
> log4j-api-2.0.1.jar
> log4j-to-slf4j-2.0.1.jar
> slf4j-api-1.7.7
> slf4j-simple-1.7.7
> The output generated is 
> -----------------------------
> [main] ERROR HelloWorld - org.apache.logging.log4j.spi.AbstractLogger
> [main] ERROR HelloWorld - org.apache.logging.log4j.spi.AbstractLogger



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

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