6 Replies Latest reply on Apr 27, 2009 11:50 PM by jaikiran pai

    default append setting to log/server.log is false

    Dimitris Andreadis Master

      Looking at https://jira.jboss.org/jira/browse/JBAS-6361.

      Our default setting for log/server.log is to re-create the file upon start-up.

       <!-- A time/date based rolling appender -->
       <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="File" value="${jboss.server.log.dir}/server.log"/>
       <param name="Append" value="false"/>
      


      I suppose this is a convenient setting for a developer environment, where you only need to keep the log for the latest run (although using a RollingFileAppender really contradicts the developer point, a plain FileAppender would be preferrable), but for a production environment you'll most probably want to keep the existing log content during a re-start.

      What do you think - should we switch to append == true?

        • 1. Re: default append setting to log/server.log is false
          Dimitris Andreadis Master

          Ok, I've set append mode to 'true' by default, which is a more logical production setting. Either this, or a developer needs to switch to a standard FileAppender that always recreates the log from scratch and doesn't keep any memory.

          • 2. Re: default append setting to log/server.log is false
            jaikiran pai Master

            Now that this param is set to true, do you think it would be better to by default use a size based rolling file appender (for server.log) instead of the time based daily rolling appender.

            I keep restarting my dev system multiple times a day and just noticed that the size of the server.log had grown up to 300 MB :)

            • 3. Re: default append setting to log/server.log is false
              jaikiran pai Master

              Hmm, i think the answer to my question lies in your previous post.

              "jaikiran" wrote:

              I keep restarting my dev system multiple times a day and just noticed that the size of the server.log had grown up to 300 MB :)


              "dimitris@jboss.org" wrote:
              I've set append mode to 'true' by default, which is a more logical production setting


              So on dev systems, i will configure this to my liking (i.e. append=false) :)

              • 4. Re: default append setting to log/server.log is false
                Dimitris Andreadis Master

                For development a standard FileAppender (non-rollgin) with append=false suits better, yes.

                • 5. Re: default append setting to log/server.log is false
                  Trustin Lee Apprentice

                  What about writing a RollingFileAppender that rolls when a log file grows up to a certain size (e.g. 4MB) and keep only several old logs (e.g. 10 x 4 = 40MB at max)? Should be pretty useful for development - shorter editor startup time and no worries for disk space.

                  • 6. Re: default append setting to log/server.log is false
                    jaikiran pai Master

                     

                    "trustin" wrote:
                    What about writing a RollingFileAppender that rolls when a log file grows up to a certain size (e.g. 4MB) and keep only several old logs (e.g. 10 x 4 = 40MB at max)? Should be pretty useful for development - shorter editor startup time and no worries for disk space.



                    It's already there in log4j :) It's commented out in the jboss-log4j.xml:
                    <!-- A size based file rolling appender
                     <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
                     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                     <param name="File" value="${jboss.server.log.dir}/server.log"/>
                     <param name="Append" value="false"/>
                     <param name="MaxFileSize" value="500KB"/>
                     <param name="MaxBackupIndex" value="1"/>
                    
                     <layout class="org.apache.log4j.PatternLayout">
                     <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
                     </layout>
                     </appender>
                     -->


                    I think it might make sense to have this size based rolling file appender (with Append=true) as default *even in production* instead of the time based appender. This way we don't have to worry about the log file growing to a large size even in production environment (imagine the user application doing a lot of logging or some other reason) during a day.
                    All we have to do is switch the "FILE" appender in jboss-log4j.xml to RollingFileAppender and set the maxfilesize and maxbackupindex to a reasonable value and also set append =true.

                    Thoughts?