4 Replies Latest reply on Jan 23, 2014 1:14 PM by paulohbmelo

    Logging per Deployment - JBoss EAP 6.1.0 Final - Bug - Server.out and Server.err messages lost

    ptjb

      With JBoss EAP 6.1.0 Final, when using logging per deployment, the Server.out and Server.err messages are lost.

       

      I have attached a example project, witht he following readme.txt

       

      Is this a bug?

       

      Also, is the expected result fully correct?

       

      About

      ----

      This project is a simple attempt to:

       

       

                1. Utilise JBoss per deployment logging

                2. Have a log4j.xml file in project to specify appenders and patterns.

                3. Log out via JUL, SLF4J, Log4j, Commons Logging

                4. Log out via ServletContext.log().

                5. Log out via System.out and System.err.

       

       

      What does not work:

       

       

                1. Log out via System.out. This log message is lost.

                2. Log out via System.err. This log message is lost.

       

       

                (i.e. see documentation for jboss 7.2 https://docs.jboss.org/author/display/AS72/Logging+Configuration)

       

       

      Test Case

      ---------

       

       

      Steps to reproduce

       

       

                1. Start server (JBoss EAP 6.1.0 Final)

                2. Deploy (mvn clean package jboss-as:deploy)

                3. Navigate to http://localhost:8080/test-logging-per-deployment

       

       

      Expected Result

       

       

                Three messages in ${jboss.server.log.dir}/server.log for:

                          "Message 5. Message from getServletContext().log()"

                          "Message 6. Message from System.out"

                          "Message 7. Message from System.err"

                Four messages in ${jboss.server.log.dir}/application-log.log for:

                          "Message 1. Log4J logger"

                          "Message 2. Commons Logger"

                          "Message 3. slf4j logger"

                          "Message 4. java util logging"

       

       

      Actual Result

       

       

                Two lost messages for:

                          "Message 6. Message from System.out"

                          "Message 7. Message from System.err"

                One messages in ${jboss.server.log.dir}/server.log for:

                          "Message 5. Message from getServletContext().log()"

                Four messages in ${jboss.server.log.dir}/application-log.log for:

                          "Message 1. Log4J logger"

                          "Message 2. Commons Logger"

                          "Message 3. slf4j logger"

                          "Message 4. java util logging"

       

       

      Notes about test case

       

       

                The logging subsystem should detect the log4j.xml file and trigger logging per deployment.

                Make sure logging per deployment in not turned off.

                If all logging appears in the the server.log file and none in the application-log.log file, logging per deployment has failed to activate,

                Log4j.xml file needed to be classpath to be detected by logging subsystem, even though the jboss documentation says can be in WEB-INF directory.

        • 1. Re: Logging per Deployment - JBoss EAP 6.1.0 Final - Bug - Server.out and Server.err messages lost
          jamezp

          This is a bug, but it should only affects log4j configurations. If you were to use a logging.properties file it does work. I've filed a JIRA to fix the log4j issue, https://issues.jboss.org/browse/LOGMGR-70.

           

          logging.properties

          # Additional loggers to configure (the root logger is always configured)
          loggers= 
          
          # Set root level and handlers
          logger.level=TRACE
          logger.handlers=FILE 
          
          handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
          handler.FILE.level=ALL
          handler.FILE.formatter=PATTERN
          handler.FILE.properties=autoFlush,append,fileName,suffix,enabled
          handler.FILE.constructorProperties=fileName,append
          handler.FILE.autoFlush=true
          handler.FILE.append=true
          handler.FILE.fileName=${jboss.server.log.dir}/application-log.log
          handler.FILE.suffix=.yyyy-MM-dd
          handler.FILE.enabled=true 
          
          formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
          formatter.PATTERN.properties=pattern
          formatter.PATTERN.constructorProperties=pattern
          formatter.PATTERN.pattern=[From logging.properties - %d{HH\:mm\:ss,SSS}] : %-5p [%c{6}] - %m%n
          

           

          Logged output:

          [From logging.properties - 09:44:11,483] : ERROR [simplelog.SimpleLog] - Message 1. Log4J logger
          [From logging.properties - 09:44:11,492] : ERROR [simplelog.SimpleLog] - Message 2. Commons Logger
          [From logging.properties - 09:44:11,492] : ERROR [simplelog.SimpleLog] - Message 3. slf4j logger
          [From logging.properties - 09:44:11,493] : SEVERE [simplelog.SimpleLog] - Message 4. java util logging
          [From logging.properties - 09:44:11,495] : INFO  [io.undertow.servlet] - Message 5. Message from getServletContext().log()
          [From logging.properties - 09:44:11,495] : INFO  [stdout] - Message 6. Message from System.out
          [From logging.properties - 09:44:11,496] : ERROR [stderr] - Message 7. Message from System.err
          [From logging.properties - 09:44:11,496] : ERROR [simplelog.SimpleLog] - The end - check for all 7 log messages.
          
          

           

          --

          James R. Perkins

          • 2. Re: Logging per Deployment - JBoss EAP 6.1.0 Final - Bug - Server.out and Server.err messages lost
            paulohbmelo

            Hi James!

             

            I did your suggestion (exactly) but the "Message 5" don't printed in the file (like yours). Do you done any extra configuration for this?

             

            Thanks in advance.

            • 3. Re: Logging per Deployment - JBoss EAP 6.1.0 Final - Bug - Server.out and Server.err messages lost
              jamezp

              I don't think I did, but it's been a while What logging facade/framework are you using?

               

              --

              James R. Perkins

              • 4. Re: Logging per Deployment - JBoss EAP 6.1.0 Final - Bug - Server.out and Server.err messages lost
                paulohbmelo

                Hi, thanks for reply.

                 

                I'm using log4j but, the log4j messages is printed. Only the messages from "getServletContext().log(...)" no.

                 

                Btw. I'm using the sample app (test-logging-per-deployment) in JBoss 6.2 EAP.