1 Reply Latest reply on Nov 18, 2004 2:37 PM by Scott Stark

    Preventing log file truncation on jboss restart

    Stan Dyck Newbie

      I'm unable to find any help on this subject either from the jboss forums or in log4j documentation.

      I'm trying to prevent log files from getting truncating when I restart jboss. I have the default log4j configuration set up. I don't have to do it often, but on occasion I have to restart jboss. When I do, The current server.log file gets overwritten and I lose an entire days worth of logs.

      I've resorted to writing an outside script to back up the current log before restarting, but I'd prefer that JBoss just continue to append to the old server.log file after a restart.

      Has anyone else solved this problem?

        • 1. Re: Preventing log file truncation on jboss restart
          Scott Stark Master

          edit the conf/log4j.xml file and set the Append parameter to true:

          <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
           <!-- ================================= -->
           <!-- Preserve messages in a local file -->
           <!-- ================================= -->
           <!-- 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.home.dir}/log/server.log"/>
           <param name="Append" value="true"/>