3 Replies Latest reply on Oct 1, 2008 5:14 PM by johnloo1

    Limiting log file size/versions under 4.0.1SP1

    johnloo1

      Sorry, I am a complete newbie at JBoss. I am running 4.0.1SP1

      Where do I set the maximum size of the JBoss log files, and the maximum number of revisions to keep? Also set the level of detail in the log messages?

      I looked in my log4j.xml file, but didn't see anything explicitly talking about file size.

      TIA

        • 1. Re: Limiting log file size/versions under 4.0.1SP1
          peterj

          I do not have 4.0.1, so I will answer based on 4.0.5 - hopefully they are not that different (yes, I know that this is a very bad assumption to make with the 4.0.x versions).

          Anyway, the default appender is the DailyRollingFileAppender which has no size limitation - it just increases is size until midnight and then a new log file is created. To limit the size, you could use the RollingFileAppender, it has a MaxFileSize parameter.

          Here is an example:

          <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="true"/>
           <param name="MaxFileSize" value="500KB"/>
           <param name="MaxBackupIndex" value="20"/>
           <layout class="org.apache.log4j.PatternLayout">
           <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
           </layout>
          </appender>


          • 2. Re: Limiting log file size/versions under 4.0.1SP1
            erasmomarciano

            I have tried with jboss-4.0.1, you should have the following file boss-4.0.1/server/all/conf/log4j.xml
            You should find the code commented as suggested by Peter

            <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="true"/>
             <param name="MaxFileSize" value="500KB"/>
             <param name="MaxBackupIndex" value="20"/>
             <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
             </layout>
            </appender>
            


            • 3. Re: Limiting log file size/versions under 4.0.1SP1
              johnloo1

              Thanks everyone!