You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Chris Yoerg <ch...@yoerg.net> on 2003/01/15 22:40:32 UTC

Problem Fixed, Thanks to You

Thank you very much, it's working nicely now.  My log4j.xml appender
def'n now looks like.
 
<!-- Custom logging for patent prior art database changes-->  
  <appender name="PRIORART"
class="org.jboss.logging.appender.DailyRollingFileAppender">
    <param name="File"
value="${jboss.server.home.dir}/log/priorart.log"/>
    <param name="Append" value="true"/>
    <param name="Threshold" value="INFO"/>
    <param name="DatePattern" value="'.'yyyy-MM"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{MMM dd,yyyy HH:mm:ss}
%-5p [%c{1}] %m%n"/>
    </layout>         
  </appender> 
 
I guess I was having problems because there aren't any decent
DailyRollingFileAppender examples that use a config.xml file in the
archives, and the javadoc stuff seems to be for direct incorporation of
log4j into .java files (not for a connector type architecture).  I also
looked in the log4j download for examples, and there aren't any
DailyRollingFileAppender examples (others yes).  The log4j.dtd is also
not available via links in the documentation, which would have solved
75% of my problems, after you gave me the hints (which really helped).
I didn't know which optional tags could or shouldn't be used, so it was
trial and error after that.  But persistence pays off in the end.  I
found DatePattern stuff within a poor example in JBoss and in javadoc
(although not the proper syntax for xml files), and Append="true" versus
"false" by experimentation.  As you are probably aware, if you restart
the server with Append = "false" the log is overwritten, if you haven't
reached the rollover date criteria yet.
 
These comments should be taken as suggestions and are not critical
comments.
 
With kindest regards,
 
Chris Yoerg
 
 
  Hi,
You need to use a DailyRollingFileAppender.  You'll get the rollover and
file naming (no overwriting).  See the javadoc for
org.apache.log4j.DailyRollingFileAppender and examples in the mailing
list archives for this list.
 
Unless I completely misunderstood your question?
 
Yoav Shapira
Millennium ChemInformatics