3 Replies Latest reply on Aug 11, 2011 4:49 AM by handyman

    Jboss deletes log files at startup

    miragpl

      Hi everyone,

       

      I'm using jboss 6. Final in my application. I would like to configure logging that way that it will presever last 10 files (20Mb) each.

      No matter what I do ${jboss.server.log.dir}/server.log is being cleared whenever jboss starts.

      Here is the handler I use  .

       

      <size-rotating-file-handler
               file-name="${jboss.server.log.dir}/server.log"
               name="FILE"
               autoflush="true"
               append="true"
               rotate-size="20M"
               max-backup-index="10">
      
             <level name="DEBUG"/>
      
          <error-manager>
               <only-once/>
            </error-manager>
      
             <formatter>
               <pattern-formatter pattern="%d %-5p [%c] (%t) %m%n"/>
            </formatter>
         </size-rotating-file-handler>
      
      

       

      Could anyone explain me what do I do wrong ?

       


      Regards,

        • 1. Re: Jboss deletes log files at startup
          handyman

          I had the same problem with Jboss 7.0.0.Final.

          Try adding an append element with value set to true.

          Otherwise changing the source code a little bit by adding these lines to

          org.jboss.as.logging.SizeRotatingFileHandlerAdd ' s performRuntime method worked for me:

           

          final Boolean append = operation.get("append").asBoolean();

          if (append != null)

                          service.setAppend(append.booleanValue());

           

          (the value of append might actually be true by default so you

          wouldn't need to actually add an append element for every file handler)

           

          Also if you expect this to work for any of the other types of file handlers

          (except async handler, whose append value basically depends on its subhandlers),

          you need to add the above lines to their performRuntime methods in their

          corresponding ...HandlerAdd classes.

          • 2. Re: Jboss deletes log files at startup
            jaikiran

            Tony, welcome to the forums!

             

             

            Tony Rizov wrote:

             

            I had the same problem with Jboss 7.0.0.Final.

            Try adding an append element with value set to true and if that doesn't work for you,

            you need to change the source code a little bit by adding these lines to

            org.jboss.as.logging.PeriodicRotatingFileHandlerAdd ' s performRuntime method:

             

            final Boolean append = operation.get("append").asBoolean();

            if (append != null)

                            service.setAppend(append.booleanValue());

             

            Is this still a problem with latest AS7 nightly builds http://community.jboss.org/thread/167590? If it's still an issue then we need to fix it, so please create a JIRA for that issue here https://issues.jboss.org/browse/AS7

            • 3. Re: Jboss deletes log files at startup
              handyman

              Thank you and yes - there still seems to be the same problem in the latest nightly build, so I created a JIRA for it.