3 Replies Latest reply on Oct 23, 2005 3:06 PM by Senthil Nathan M

    log4j help required

    Ramesh Newbie

      I've 2 war files and I deployed in Jboss. Each war has its own log4j configuration. Every war created it's own log file. but the problem is all the logged messages(from 1 & 2 war) are writing to a single log.
      Can any one suggest how to do this?
      thanks in advance

      Ramesh

        • 1. Re: log4j help required
          Wiley Snyder Newbie

          I learned this from the Orielly Developer Notebook .... very helpfull by the way ....

          in the log4j I made an entry for my app ...

          
          <appender name="MYAPP" class="org.jboss.logging.appender.DailyRollingFileAppender">
           <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
           <param name="File" value="${jboss.server.home.dir}/log/MYAPP.log"/>
           <param name="Append" value="false"/>
          
           <!-- 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"/>
           -->
          
           <layout class="org.apache.log4j.PatternLayout">
           <!-- The default pattern: Date Priority [Category] Message\n -->
           <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
          
           <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
           <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
           -->
           </layout>
           </appender>
          
          


          then I specified the error I want to log ...

          
           <category name="MYAPP.web">// my class folder logging
           <priority value="ERROR"/>
           <appender-ref ref="MYAPP"/>
           </category>
          


          then added to the root node ...
           <root>
           <appender-ref ref="CONSOLE"/>
           <appender-ref ref="FILE"/>
           <appender-ref ref="MYAPP"/>
          
           </root>
          


          everything seems to be A-OK .... maybe if you specified 2 category names for the same app possibly .... just a thought





          • 2. Re: log4j help required
            jaikiran pai Master

            Have a look at using your own log4j.xml section in:

            http://www.jboss.org/wiki/Wiki.jsp?page=Logging

            Even the following link might help:

            http://www.qos.ch/logging/sc.jsp


            • 3. log4j help required
              Senthil Nathan M Newbie

              Hi,

              Please reply to this message
              http://groups.yahoo.com/group/jboss_expert/message/71

              We are using log4j file appender.
              My production JBOSS server was rolling the log evey midnight till Sep
              26th. From 27th it is just over writing the server.log without backing
              up this file with date in the file name. We did not change any
              configuration on Sep 27th except re started JBOSS. Does any body has
              any idea what could be wrong.
              I have 2 JBOSS instances on the same server both have the same issue.
              Windows Server 2003 Enterprize edition SP 1.
              I removed all the old server log files, still the same issue.

              this is from my log4j.xml






              <!-- 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"/>
              -->


              <!-- The default pattern: Date Priority [Category] Message\n
              -->


              <!-- The full pattern: Date MS Priority [Category]
              (Thread:NDC) Message\n

              -->