7 Replies Latest reply on Dec 10, 2015 1:06 PM by Khai Nguyen

    Jboss deletes boot.log during startup

    Sri Ram Newbie

      I'm using Jboss 6.1.0.Final with my application. I trying to rotate the jboss boot log using logrotate on daily basis, but i can't do it. Because whenever jboss starts, it deletes the old jboss boot.log (truncates) and creates a new boot.log. This boot log is configured using logging.properties which doesn't have 'append' property. I can't find any documentation to rotate the jboss boot log in jboss 6.x or 7.x release. Any ideas?

       

      My logging.properties :

       

      logger.level=DEBUG
      logger.handlers=BOOTLOG
      
      handler.BOOTLOG=org.jboss.logmanager.handlers.FileHandler
      handler.BOOTLOG.level=DEBUg
      handler.BOOTLOG.properties=autoFlush,fileName
      handler.BOOTLOG.append=true
      handler.BOOTLOG.autoFlush=true
      handler.BOOTLOG.fileName=${myapp.logdir}/jboss_boot.log
      handler.BOOTLOG.formatter=PATTERN
      
      formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
      formatter.PATTERN.properties=pattern
      formatter.PATTERN.pattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{1}] %m%n
      
        • 1. Re: Jboss deletes boot.log during startup
          ud1 Newbie

          Setters are invoked in the order they are listed in "handler.BOOTLOG.properties" property, "append" should go before "fileName":

           

           

          # Additional logger names to configure (root logger is always configured)
          #loggers=org.jboss.whatever,org.jboss.foo
          loggers=org.jboss.system.server.ServerInfo, org.jboss.detailed.classloader.ClassLoaderManager
          
          # Root logger level
          logger.level=INFO
          # Root logger handlers
          logger.handlers=FILE
          
          # Allow debug logging from ServerInfo to get the system properties dump
          logger.org.jboss.system.server.ServerInfo.level=DEBUG
          logger.org.jboss.detailed.classloader.ClassLoaderManager.level=ERROR
          
          # Boot log file handler configuration
          handler.FILE=org.jboss.logmanager.handlers.FileHandler
          handler.FILE.level=DEBUG
          handler.FILE.properties=autoFlush,append,fileName
          handler.FILE.autoFlush=true
          handler.FILE.append=true
          handler.FILE.fileName=../server/default/log/boot.log
          handler.FILE.formatter=PATTERN
          
          # Formatter pattern configuration
          formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
          formatter.PATTERN.properties=pattern
          formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p (%t:%x) [%c] %s%E%n
          
          
          • 2. Re: Jboss deletes boot.log during startup
            David Balažic Newbie

            I have the same problem with 7.1.1.Final

            On each restart boot.log is overwritten.

            I have tried to add a "handler.FILE.append=true" line as suggested above, but it does not help.

             

            Regards,

            David

            • 3. Re: Jboss deletes boot.log during startup
              erasmo2 marciano2 Master

              Hi

              You can try

              handler.BOOTLOG.autoFlush=false


              OR


              handler.BOOTLOG.fileName=${myapp.logdir}/jboss_boot.log   add a timestamp into name of the file /jboss_boot.log




              • 4. Re: Re: Jboss deletes boot.log during startup
                David Balažic Newbie

                That would not work, as the file content is:

                 

                # File handler configuration
                handler.FILE=org.jboss.logmanager.handlers.FileHandler
                handler.FILE.level=DEBUG
                handler.FILE.properties=autoFlush,fileName
                handler.FILE.autoFlush=true
                handler.FILE.append=true
                handler.FILE.fileName=${org.jboss.boot.log.file:boot.log}
                handler.FILE.formatter=PATTERN
                

                 

                If I change handler.FILE.fileName line to handler.FILE.fileName=/tmp/test.log, then the logs (after restarting JBoss of course) go to /tmp/test.log

                so this is the correct place and syntax.

                 

                It is just that the handler.FILE.append=true line makes no effect.

                 

                What version of JBoss AS is everybody using these days?

                • 5. Re: Re: Jboss deletes boot.log during startup
                  Tomaz Cerar Master

                  David Balažic wrote:

                   

                  What version of JBoss AS is everybody using these days?

                  I would say latest nightly build of WildFly   you can get it at https://community.jboss.org/thread/224262

                   

                  Or you could got with 7.2.0.Final (binary released as EAP 6.1.Alpha)

                  • 6. Re: Re: Jboss deletes boot.log during startup
                    David Balažic Newbie

                    Alpha?

                    Here it says 6.1.0 Final.

                     

                    So this does not work with 7.1.x (topic)?

                    • 7. Re: Jboss deletes boot.log during startup
                      Khai Nguyen Newbie

                      Hi all,

                       

                      Here is the solution:

                       

                      You have to declare "append" before "fileName" in properties value. So it would pick up append value (true).

                       

                      handler.BOOT.properties=append,autoFlush,fileName
                      handler.BOOT.append=true
                      

                       

                       

                      The rest is same.