7 Replies Latest reply on Feb 18, 2014 11:57 AM by James Perkins

    [URGENT] I Am Confused About EAP 6.1 Logging

    Charles Odili Apprentice

      I am trying to switch to JBoss EAP 6.1 and am really struggling to understand what I need to do to see console log output for my app. Its an Errai app, and has a log4j.properties file in src/main/resources/ which gets copied into src/main/webapp/classes/ I am using org.apache.log4j.Logger and I log most messages with log.info(...).

       

      Please, what exactly do I do to use the new logging system? I just want to see console log messages. Thanks in advance.

        • 1. Re: [URGENT] I Am Confused About EAP 6.1 Logging
          Wolf-Dieter Fink Master

          Did you exclude the JBoss module log4j from your application via jboss-deployment-structure.xml?

          Also you need to set -Dorg.jboss.as.logging.per-deployment=true property during server start

          • 2. Re: [URGENT] I Am Confused About EAP 6.1 Logging
            Charles Odili Apprentice

            Yes, I added a jboss-deployment-structure.xml file to WEB-INF folder of the webapp. The file has the following contents

            <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

                <deployment>

                    <exclusions>

                        <module name="org.apache.log4j"/>

                        <module name="org.apache.commons.logging"/>

                    </exclusions>

                </deployment>

            </jboss-deployment-structure>

             

            Are you saying I need to set -Dorg.jboss.as.logging.per-deployment=true before I can use the new logging system, I thought that was the default behaviour for EAP 6.1 and I thought (not sure again) the  jboss-deployment-structure.xml was needed if I wanted to disable the new logging system. I actually want to use the new logging system, but with portable log4j code and already existing log4j.properties file.

            • 3. Re: [URGENT] I Am Confused About EAP 6.1 Logging
              Wolf-Dieter Fink Master

              Did you use a ear or war file, you need to add the jboss-deployment-structure.xml to your top-level deployment META-INF or WEB-INF folder.

              From a code perspective you don't need a change, the log4j logger are supported.

              I prefer to use the standalone/domain configuration and drop the applicatio specific log configuration to be able to change the logging during runtime

              • 4. Re: [URGENT] I Am Confused About EAP 6.1 Logging
                Charles Odili Apprentice

                Thanks, its a war file, and the jboss-deployment-structure.xml file is sitting on the root / floor of the WEB-INF folder (src/main/webapp/WEB-INF/jboss-deployment-structure.xml)

                "I prefer to use the standalone/domain configuration and drop the applicatio specific log configuration to be able to change the logging during runtime" Ok, how do I do this. I am new to AS / EAP. Thanks again.

                • 5. Re: [URGENT] I Am Confused About EAP 6.1 Logging
                  James Perkins Master

                  If you're just logging to the console the best solution is to not use the log4j.properties file. If you just leave that out, logging will be configured by the logging subsystem.

                   

                  --

                  James R. Perkins

                  1 of 1 people found this helpful
                  • 6. Re: [URGENT] I Am Confused About EAP 6.1 Logging
                    Charles Odili Apprentice

                    Thanks James. Yes, removing log4j.properties makes console output to show. But I was hoping for a solution that would work in case the log4j.properties file becomes necessary, especially since its an Errai app the they always use log4j.properties. I don't want to rely on a solution that is based on removing a component that may be important. Below is the content of the log4j.properties file.

                     

                    log4j.rootLogger=INFO, mainlogger

                    log4j.appender.mainlogger=org.apache.log4j.ConsoleAppender

                    log4j.appender.mainlogger.target=System.out

                    log4j.appender.mainlogger.layout=org.apache.log4j.PatternLayout

                    log4j.appender.mainlogger.layout.ConversionPattern=%p [%c{1}] %m%n

                     

                    #log4j.logger.org.jboss.errai.cdi.server.events=DEBUG

                     

                    So, if my app has a log4j.properties file with the above contents, and I am only logging to console (no file logging for now), what do I do / what steps do I take to see my log output.

                    • 7. Re: Re: [URGENT] I Am Confused About EAP 6.1 Logging
                      James Perkins Master

                      There were some issues with log4j in EAP 6.0 and EAP 6.1 that were fixed in EAP 6.2. If possible you might want to try to upgrade to 6.2 and see if that helps. Otherwise if you need to stick with EAP 6.1 then you can add a system property of org.jboss.as.logging.per-deployment=false*.

                       

                      CLI Example:

                      /system-property=org.jboss.as.logging.per-deployment:add(value=true)
                      

                       

                      This will disable the processor from running and looking for configuration files.

                       

                      --

                      James R. Perkins

                       

                      * Note: The org.jboss.as.logging.per-deployment is deprecated in WildFly and might end up deprecated (not removed) from a future version of EAP 6.x.