6 Replies Latest reply on Nov 21, 2006 4:48 AM by jaikiran pai

    Disabling Daily Logs

    Yogesh Novice

      Hello,
      I would like to know how to disable the daily server.log files which are created by JBoss in the /default/log folder. I am using jboss-4.0.4.GA-jems.

      Thnx.
      Yogesh

        • 1. Re: Disabling Daily Logs
          jaikiran pai Master

          You mean you want to disable the rollover feature in log4j where the files gets renamed to something like server.log.2006-03-07.log? Or do you want to disable the logging itself?

          If it's the former then, you will have to modify the contents the log4j.xml file present in %JBOSS_HOME%/server/default/conf folder. This files contain a appender named "FILE" which you will have to change to:

          <appender name="FILE" class="org.jboss.logging.appender.FileAppender">
           <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
           <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
           <param name="Append" value="false"/>
          
           <layout class="org.apache.log4j.PatternLayout">
           <param name="ConversionPattern" value="%d{ISO8601} [%X{TAPUSERNAME}] %-5p [%c] %m%n"/>
           </layout>
           </appender>




          • 2. Re: Disabling Daily Logs
            Yogesh Novice

            Hi jaikiran,
            I tried uncommenting the lines:

            
             <!-- Rollover at midnight each day
             <param name="DatePattern" value="'.'yyyy-MM-dd"/>
             -->
            
             <!-- Rollover at the top of each hour
             <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
             -->
            
            
            


            but these led to no changes...i can see your configs have these two lines missing ...... i hope this would make it.


            Thnx for helping.

            Cheers,
            Yogesh



            • 3. Re: Disabling Daily Logs
              jaikiran pai Master

              Can you post the contents of your log4j.xml? Also, you want the logs to go in a single file named server.log instead of files like server.log.2006-03-07.log. Am i right?

              • 4. Re: Disabling Daily Logs
                Yogesh Novice

                Hi,
                My requirements are as follows:

                I only want one server.log file and limit its size to say around 100MB as diskspace on my server is limited.

                I would also know if it possible to configure log4j to generate all logs in a MySQL Database


                Thnx.

                Regards,
                Yogesh

                • 5. Re: Disabling Daily Logs
                  jaikiran pai Master

                  Yes you can configure log4j to log into database. Have a look at:

                  http://www.onjava.com/pub/a/onjava/2002/08/07/log4j.html?page=3

                  • 6. Re: Disabling Daily Logs
                    jaikiran pai Master

                     

                    I only want one server.log file and limit its size to say around 100MB as diskspace on my server is limited.


                    I guess this one should work:

                    <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
                     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                     <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
                     <param name="Append" value="false"/>
                     <param name="MaxFileSize" value="100MB"/>
                     <param name="MaxBackupIndex" value="0"/>
                    
                     <layout class="org.apache.log4j.PatternLayout">
                     <param name="ConversionPattern" value="%d{ISO8601} [%X{TAPUSERNAME}] %-5p [%c] %m%n"/>
                     </layout>
                     </appender>