1 Reply Latest reply on Jun 17, 2004 11:28 AM by ghoyle

    Log4j  output to files

    ghoyle

      I have put some log4j code into my ejb's.
      I then want to log to 2 seperate files so I have modified log4j.xml to do this and I have been succesful.
      However the out put to the file is a little too verbose e.g. I get


      2004-06-18 16:15:59,156 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,156 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,156 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,156 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,170 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,170 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,171 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,171 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,171 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,171 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created
      2004-06-18 16:15:59,171 [RMI TCP Connection(41)-192.168.0.64] INFO STDOUT - 1423335 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user24027736 Created


      i.e. it is repeating itself .
      All i want it to do is output the first line i.e.

      2004-06-18 16:15:58,966 [RMI TCP Connection(41)-192.168.0.64] INFO jblog.AuthorBean - User user19413864 Created


      and not all the stuff with the stdout.
      the code i used to create the new file is

      <appender name="OPERATIONALFILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="File" value="/home/geoff/log/operational.log"/>
       <param name="Append" value="false"/>
       <param name="Threshold" value="INFO"/>
       <!-- 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 [%t] %-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>
      


      Anyone know where I am going wrong>?

      Thanks in Advance

      Geoff

        • 1. Re: Log4j  output to files
          ghoyle

          Also just rembered, when I change the date it does nto seem to roll over the file.
          Should'nt the operational..log become operational.log.dd-mm-yy when i change the date?