Hi Klaus-

I think your problem is in the way you're initializing your
DailyRollingFileAppender.  The DailyRollingFileAppender (per the JavaDoc)
constructor takes a layout, filename, and date pattern.  The filename you're
providing is "d:/is/share/system/log/error-log-".  That is why log4j is
creating a file named "error-log-".  The date pattern you provide
"yyyy-MM-dd-HH-mm" rolls over at the top of every minute.  So, the
DailyRollingFileAppender is working correctly - just not the way you want
it.  I don't know what the '.log' is for in your constructor.....?

Check out the JavaDoc for the DailyRollingFileAppender.  It explains all the
various date patterns.

I am having a problem getting the DailyRollingFileAppender to roll over
daily.  I am using a config file:

# D is set to be a DailyRollingFileAppender
log4j.appender.D=org.apache.log4j.DailyRollingFileAppender

# Set the name of the log file created: fms.log
log4j.appender.D.File=fms.log

# Set the date pattern to roll over daily (at midnight)
log4j.appender.D.DatePattern='.'yyyy-MM-dd

# Set the pattern
log4j.appender.D.layout=org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern=%-15d{ABSOLUTE} %-10p (%c) - %m%n

The file is never rolled over - the log messages continue to be appended to
the original log.  I heard that you had to have your server running when the
rollover is to occur - but that there was a DailyRollingFileAppenderExt jar
that solved this.  Anybody know anything about this?  I didn't have any
problems with the RollingFileAppender..... 

Thanks-
Sara

-----Original Message-----
From: Klaus Mueller [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 15, 2002 3:32 AM
To: '[EMAIL PROTECTED]'
Subject: DailyRollingFileAppender Question


Hi,

I'm new at log4j and have a problem.

I need to use the DailyRollingFileAppender to log messages. I create the
Appender using the following statement:

errorCategory.addAppender(new DailyRollingFileAppender(layout,
"d:/is/share/system/log/error-log-", "yyyy-MM-dd-HH-mm'.log'"));

The problem is a wrong file creation. Log4J creates a file called
"error-log-" and overwrites the file every minute with the next error
messages.

Does anyone know about troubles with this appender?

I use W2k and the following java version:

[y:\core] java -version
java version "1.2.2"
Classic VM (build JDK-1.2.2_007, native threads, symcjit)

Thanks
Klaus

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to