
Thank you Jan-Olav, but sorry, should have read the documentation first. I achieve what I want just by adding the file property <appender name="filesystem" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>log.txt</file> <encoder> <pattern>%d %5p [%t] %c{1} - %msg%n</pattern> </encoder> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>log-%d{yyyy-MM-dd_HH-mm}.txt.%i</fileNamePattern> <TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>1000MB</maxFileSize> </TimeBasedFileNamingAndTriggeringPolicy > </rollingPolicy> </appender> PerJ From: Logback-user [mailto:logback-user-bounces@qos.ch] On Behalf Of Jan-Olav Eide Sent: 4. november 2013 12:07 To: logback users list Subject: Re: [logback-user] TimeBasedRollingPolicy How about : String activeLogFile = "a file name of your choice"; LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); RollingFileAppender<ILoggingEvent> appender = new RollingFileAppender<ILoggingEvent>(); appender.setContext(loggerContext); appender.setFile(activeLogFile); String archiveDir = "a directory of your choice" createIfNeeded(archiveDir); TimeBasedRollingPolicy<ILoggingEvent> timePolicy = new TimeBasedRollingPolicy<ILoggingEvent>(); timePolicy.setFileNamePattern(archiveDir + patternFor("%d{yyyy-MM-dd,aux}/%d{yyyy-MM-dd-hh}")); // hourly ..... On 4 November 2013 11:09, Per Jørgen Vigdal <Per.Jorgen.Vigdal@evry.com<mailto:Per.Jorgen.Vigdal@evry.com>> wrote: Hallo. Is it possible to configure a TimeBasedRollingPolicy so that the file that it is being logged to does not have any date in the filename, but the rolled over files has. Thanks PerJ _______________________________________________ Logback-user mailing list Logback-user@qos.ch<mailto:Logback-user@qos.ch> http://mailman.qos.ch/mailman/listinfo/logback-user