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 "GrĂ¼bel, Nicole" <Ni...@huk-coburg.de> on 2002/07/16 10:27:51 UTC

DailyRollingFileAppender & RollingFileAppender don't create backups

Hi!

I know, these appenders have already been discussed, but I couldn't find
a solution that would work in the archive.

I just want to have an appender that rolls every day (DailyFile) and
creates/saves 1 log-file (DailyLog4J.log) and 1 backup-file.
And I want another appender that rolls when the file-size reaches for
example 5KB (RollingFile) and creates/saves 1 log-file
(RollingLog4J.log) and for example 2 backup-files.
I tried the following configuration ...

<appender name = "DailyFile" class =
"org.apache.log4j.DailyRollingFileAppender">
	<param name = "Threshold" value = "INFO" />
	<param name = "Append" value = "false" />
	<param name = "DatePattern" value = "'.'yyyy-MM-dd" />

	<param name = "File" value =
"o:\\Mp_safir\\umgebung\\Log4J-Test\\DailyLog4J.log" />
	<layout class = "org.apache.log4j.PatternLayout">
		<param name = "ConversionPattern" value = "%d{dd.MM.yyyy
HH:mm:ss} %-5p: [%m]%n" />
	</layout>	
</appender>

<appender name = "RollingFile" class =
"org.apache.log4j.RollingFileAppender">
	<param name = "Append" value = "false" />
	<param name = "maxFileSize" value = "5KB" />
	<param name = "maxBackupIndex" value = "2" /> 
	<param name = "File" value =
"o:\\Mp_safir\\umgebung\\Log4J-Test\\RollingLog4J.log" />
	<layout class = "org.apache.log4j.PatternLayout">
		<param name = "ConversionPattern" value = "%d{dd.MM.yyyy
HH:mm:ss} %-5p: [%m]%n" />
	</layout>	
</appender>

Well, I first didn't have the append-parameter set. No rolling happend
at all.
With append = false I finally get a reaction ... but not a useful one.
The log-files are cleared and the logging continues, but there are no
backup-files created. The strangest thing is that the log-files seem to
be cleared not only at the configured rolling-events (file-size or
date), but everytime a loggin occurs.
I guess this unwanted clearing is caused by the append-parameter, but I
don't have a clue why it is there at all then - it doesn't seem to make
sense to me, when you don't save any of your logging ...
Am I using a wrong configuration for my purpose? I really would
appreciate any advice and/or sample-configurations.
I'm currently still using 1.1.3 - but we'll switch to 1.5.2 soon, if
this can have any influence on this problem.

Thanks!

Nicole Gruebel  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>