3 Replies Latest reply on Jun 13, 2012 2:10 PM by Wolf-Dieter Fink

    JBoss RollingFileAppender not appending

    celkins Newbie

      We are currently using the DailyRollingFileAppender in our JBoss installation (JBoss 1.5.0.GA) and ending up with some pretty massive logs at times.  The decision was made to change to size based logging to resolve this.  I commented out the DailyRollingFileApender block in the jboss-log4j.xml and uncommented the RollingFileAppender block.  I then made some modifications to the configuration to arrive at the below block to suit our needs;

       

      <!-- 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="true"/>
        <param name="MaxFileSize" value="100MB"/>
        <param name="MaxBackupIndex" value="5"/>
      
        <layout class="org.apache.log4j.PatternLayout">
          <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n"/>
        </layout>
      </appender>
      

       

      Now When I start up JBoss it writes all logging to the boot.log never updating server.log.  I've done quite a bit of online research and reviewed our configurations, but I can not find a flaw in our configuration.  Any ideas on what I may have missed would be greatly appreciated.  Incidentally, even if I leave the RollingFileAppender with the default configuration I get the same result.  Thank you for your help.

       

      Chris

        • 1. Re: JBoss RollingFileAppender not appending
          Peter Johnson Master

          That is the exact same text I use for one of my servers (well, the sizes are different), and it works for me. So there must be something else going on. Things I would verify or try:

           

          a) Make sure that I edited the correct file. This usually involves hidding all of the other directories under jboss_home/server except for the one I am using.

           

          a2) Make sure I edited the file correctly by opening it in an editor that will validate it against the schema.

           

          b) Do a text file search for "<appender", make sure it shows up in only the one file.

           

          c) Change the logging level on the console log, see if I get more/less output.

           

          d) Delete the file and see what happens.

          1 of 1 people found this helpful
          • 2. Re: JBoss RollingFileAppender not appending
            celkins Newbie

            Peter, thank you, your response pointed me in the right direction.  Here's how I solved the problem;

             

             

            I had edited the correct file, "/server/default/conf/jboss-log4j.xml", but I could not validate it as it could not find the log4j.dtd file.  Researching online I found that I could extract that file from log4j.jar in the "/common/lib" folder.  After extracting log4j.dtd to the "server/default/conf" folder I was able to successfully deduce the problem.  I had commented out the original DailyRollingFileAppender block and, in an effort to maintain the original comments within the block, simply removed part of the inner comments closing tags (i.e. '-->' became '->').  This was causing an unseen 'Incorrect syntax' error.  When I modified the inner comments beginning tags from '<!--' to '<!-' the problem resolved itself and logging occurred as expected.

            • 3. Re: JBoss RollingFileAppender not appending
              Wolf-Dieter Fink Master

              You don't need a dtd for that. The minimal XML check can be done by an editor like JEdit or Eclipse