10 Replies Latest reply on Jun 4, 2011 11:12 PM by agasthi_k

    log truncated on startup

    eflat

      My jboss log gets truncated on startup whenever I stop/start jboss. Is there a setting somewhere so it doesn't do that? Version is 4.2.1.

      Thanks!

        • 1. Re: log truncated on startup
          peterj

          Every time your start the app server it will overwrite the log file. You can change this in server/xxx/conf/jboss-log4j.xml. Check the Log4J docs for what options are available. You can change the Append parameter to tru:

          <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
           . . .
           <param name="Append" value="true"/>
           . . .





          • 2. Re: log truncated on startup
            eflat

            Yes, that got it -- thanks!

            • 3. Re: log truncated on startup
              agasthi_k

              Hi Peter,

               

              I have customised my jboss-log4j.xml as below

               

              <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="/opt/www/logs/jboss/server.log"/>

                    <param name="Append" value="true"/>

               

               

              Inspite of setting the Append param value to true, the jboss server.log file is getting truncated on every restart. Is there anything else I need to set ?

               

              Regards,

              AK

              • 4. Re: log truncated on startup
                peterj

                That always works for me. First, which version of JBoss AS? Second, try adding -Dlog4j.debug=true to the JAVA_OPTS in run.conf. That whould cause log4j to print some information about how it is going about initializing the logging - that might give you more information.

                 

                At least, I hope log4j.debug is the correct option, my Log4J book is at work and I'm at home. I'll double check tomorrow when I am in the office if you still have problems.

                • 5. log truncated on startup
                  agasthi_k

                  Thanks Peter for your quick response

                   

                  I am using JBOSS 5.1 EAP version on a RHEL 5.3. I have enabled -Dlog4j.debug=true in the run.conf. Is there anything specifc I need to check about that ?

                  • 6. log truncated on startup
                    jaikiran

                    Aye Kay wrote:

                     

                          <param name="File" value="/opt/www/logs/jboss/server.log"/>

                          <param name="Append" value="true"/>

                     

                     

                    Inspite of setting the Append param value to true, the jboss server.log file is getting truncated on every restart.

                    Just to be sure - you're checking the /opt/www/logs/jboss/server.log file, right?

                    • 7. log truncated on startup
                      peterj

                      Also, append works only if the existing log file is from the same day. If the log file is from a previous day, it will be renumbered and a new log created.

                      • 8. log truncated on startup
                        agasthi_k

                        Yes Peter,

                         

                        Its the file from the same day.

                        • 9. log truncated on startup
                          agasthi_k

                          Yes Jaikiran.

                          • 10. Re: log truncated on startup
                            agasthi_k

                            Guys,

                             

                            It was a miss from my end, was a custom setting used to echo out some details to the log file and this statement flushed the file at startup each time.

                             

                            Thanks for your help.