Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-6589

MDC is ignored when using Log4J 2 API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • Logging, Modules
    • None
    • Hide
      1. Add below pattern-formatter in logging susbsystem of  handler :
      2.   <formatter>
                            <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) [deployment=%X\{deployment}] %s%E%n"/>
          </formatter>
      3. Deploy [^logging-poc-0.0.1-SNAPSHOT.war]and check the results.
      Show
      Add below pattern-formatter in logging susbsystem of  handler :   <formatter>                     <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) [deployment=%X\{deployment}] %s%E%n"/>   </formatter> Deploy [^logging-poc-0.0.1-SNAPSHOT.war] and check the results.

      When logging via the Log4J 2 API MDC-variables are not filled in the output. The output of the reproducer is as follows :

      15:31:38,326 INFO [TestServlet] (default task-3) [deployment=] Log4J 2
      15:31:38,327 INFO [TestServlet] (default task-3) [deployment=logging-poc] Log4J 1
      15:31:38,328 INFO [TestServlet] (default task-3) [deployment=logging-poc] SLF4J 1
      15:31:38,328 INFO [TestServlet] (default task-3) [deployment=logging-poc] java.util.logging
      15:31:38,328 INFO [TestServlet] (default task-3) [deployment=logging-poc] commons-logging

       

      Expactation: MDC-Variables are considered regardless of logging API.

              rhn-support-rbudinsk Rastislav Budinský (Inactive)
              rhn-support-rbudinsk Rastislav Budinský (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: