[logback-user] For RollingFileAppender, <rollingPolicy>/<fileNamePattern> does not work if you also have <appender>/<file>

RobOaks roboaks at comcast.net
Tue Nov 27 22:45:12 CET 2012


In addition to the problems I reported in my previous post (
http://old.nabble.com/Config-file-failures-unexplained-in-list-or-JIRA-td34713039.html#a34713039
http://old.nabble.com/Config-file-failures-unexplained-in-list-or-JIRA-td34713039.html#a34713039
) , I have found that, for the RollingFileAppender,
<rollingPolicy>/<fileNamePattern> does not work if you also have
<appender>/<file>. Here is the relevant section of my config file:

<appender name="file"
class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>Idcp.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>%d{yyyy-MM-dd_HH-mm}_Idcp.log</fileNamePattern>
			<maxHistory>3</maxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%-5level %logger{}.%method - %msg%n </pattern>
		</encoder>
</appender>

With this configuration, all output goes to Idcp.log indefinitely, in spite
of the fact that it should be creating an archive file every minute. As soon
as I remove <file>Idcp.log</file>, active output is logged to a file of the
form yyyy-MM-dd_HH-mm_Idcp.log and a new file is created every minute.

But, even in the latter case, when archive files are being properly created,
<maxHistory> is ignored and archive files are created ad infinitum.

Is this a particularly buggy release of Logback? I’m really hoping it’s just
me.

-- 
View this message in context: http://old.nabble.com/For-RollingFileAppender%2C-%3CrollingPolicy%3E-%3CfileNamePattern%3E-does-not-work-if-you-also-have-%3Cappender%3E-%3Cfile%3E-tp34729737p34729737.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list