Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-796

Log4J2 API not logging correct message with SL4J Simple Logger

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1
    • Component/s: API, SLF4J Bridge
    • Labels:
      None

      Description

      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

        Attachments

          Activity

            People

            • Assignee:
              remkop@yahoo.com Remko Popma
              Reporter:
              yogu13 Yogesh Rao
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: