5 Replies Latest reply on Jul 3, 2013 9:02 PM by jamezp

    JBoss AS 7.1.1 Final is not picking up application level logging.properties file

    arkhalil

      Hi All,

      I updated logging.properties file by adding some custom formatters and placed it in mywebapp\WEB-INF\classes directory. But it is not picked up by JBoss AS 7.1.1. Even it is not using default one is being used i.e. $JBOSS_HOME\standalone\configuration\logging.properties. But using the one that is under JRE\lib directory.

       

      Does anyone know how to use application lever logging.properties file (i.e. per-deployment logging.properties)?

       

      Thanks.

        • 1. Re: JBoss AS 7.1.1 Final is not picking up application level logging.properties file
          jamezp

          The per-deployment logging was not introduced until JBoss AS 7.1.2.Final (maybe .3) tags. It made it into EAP 6.1 and it's in the WildFly alpha releases as well, but not JBoss AS 7.1.1.Final and lower. Also note it uses a custom logging.properties format. It's not the same as the JUL logging format. It's very much like the log4j.properties format.

           

          If you'd like to give WildFly or the $0 EAP 6 subscription a try and you need help converting a JUL style logging.properties to one that can be used by jboss-logmanager, I'm happy to help.

           

          --

          James R. Perkins

          • 2. Re: JBoss AS 7.1.1 Final is not picking up application level logging.properties file
            arkhalil

            Thanks James. You mean it is not extending/customizing JUL interfaces. But it is a different api from JBoss.

             

            Can I use WildFly alpha2 on production environment (in standalone mode)? Or it is experiental/buggy currently?

            • 3. Re: JBoss AS 7.1.1 Final is not picking up application level logging.properties file
              jamezp

              The jboss-logmanager does extend JUL, but it doesn't use the same format for the configuration file. An example logging.properties:

               

              # Additional loggers to configure (the root logger is always configured)
              loggers=com.example
              
              
              # Configure root logger
              logger.level=INFO
              logger.handlers=CONSOLE,FILE
              
              logger.com.example.level=DEBUG
              
              handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
              handler.CONSOLE.level=INFO
              handler.CONSOLE.formatter=CONSOLE
              handler.CONSOLE.properties=autoFlush,target,enabled
              handler.CONSOLE.autoFlush=true
              handler.CONSOLE.target=SYSTEM_OUT
              handler.CONSOLE.enabled=true
              
              handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
              handler.FILE.level=ALL
              handler.FILE.formatter=FILE
              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}/server.log
              handler.FILE.suffix=.yyyy-MM-dd
              handler.FILE.enabled=true
              
              formatter.CONSOLE=org.jboss.logmanager.formatters.PatternFormatter
              formatter.CONSOLE.properties=pattern
              formatter.CONSOLE.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%E%n
              
              formatter.FILE=org.jboss.logmanager.formatters.PatternFormatter
              formatter.FILE.properties=pattern
              formatter.FILE.constructorProperties=pattern
              formatter.FILE.pattern=%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%E%n
              
              

               

              You could use WildFly in production. There are some new features, mainly Java EE 7 features, and by default it uses undertow rather than JBossWeb.

               

              --

              James R. Perkins

              • 4. Re: JBoss AS 7.1.1 Final is not picking up application level logging.properties file
                arkhalil

                Can you tell me how can I configure the following custom formater in logging.properties?

                 

                package com.mycomp.common.logging;

                 

                 

                import java.util.logging.Formatter;

                import java.util.logging.LogRecord;

                 

                 

                public class CustomFormatter extends Formatter {

                 

                 

                          @Override

                          public String format(LogRecord record) {

                                    return "ConsoleFormatter:\n" + super.formatMessage(record);

                          }

                }

                 

                 

                Thanks.

                • 5. Re: JBoss AS 7.1.1 Final is not picking up application level logging.properties file
                  jamezp

                  At this point custom formatters aren't allowed, though there is a JIRA for it. I have started making some preliminary changes to allow that, but haven't started the actual work yet.

                   

                  --

                  James R. Perkins