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

Remko Popma commented on LOG4J2-796:
------------------------------------

You raise an interesting point. Currently the log4j-to-slf4j module has these 
dependencies:
* log4j-api
* slf4j-api
* logback-core [test]
* logback-core-test [test]
* logback-classic [test]

This means that the JUnit tests for the log4j-to-slf4j module have the 
logback-classic implementation of the Logger interface in the classpath, making 
it difficult to test against other SLF4J implementations.

I can think of two ways to solve this. One being your suggestion to dynamically 
set the classpath for each test. Another solution would be to create a 
different module that contains only JUnit tests for the slf4j-simple 
implementation. (There may be other solutions I haven't thought of.)

To be honest I find both solutions a bit too heavy; they introduce too much 
complexity for the relatively small benefit of having a JUnit test for the 
slf4j-simple implementation.

I'm thinking to just fix this issue and not have a JUnit test. 
I'm having trouble committing at the moment, but after I succeed in committing 
the fix, I'l resolve this issue and you can verify that the solution works.

> 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.3.4#6332)

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

Reply via email to