[logback-user] Delete log file

Jeff Jensen jjensen at apache.org
Wed Nov 17 01:06:48 CET 2010


With append=false, log a start message (e.g. "Starting"), which will
then overwrite the file.  Is that good enough for the needs?


On Tue, Nov 16, 2010 at 10:47 AM,  <pwillems66 at zonnet.nl> wrote:
> Hi,
>
> For every test we do, we need a log file.
> If the test fails, the log file can be viewed and the errors can be fixed.
> If the errors are fixed and the test runs again and there are no errors, I
> want to delete this log file.
> Is it possible to delete a log file? (While file is is use by logback!)
> If yes, how?
>
> My configuration is:
> <?xml version="1.0" encoding="UTF-8" ?>
> <configuration>
>
>  <appender name="RootSiftAppender"
> class="ch.qos.logback.classic.sift.SiftingAppender">
>   <append>false</append>    <discriminator>
>     <Key>testname</Key>
>     <DefaultValue>testrun</DefaultValue>
>   </discriminator>
>   <sift>
>     <appender name="FILE-${testname}"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>       <File>${testname}.log</File>
>       <rollingPolicy
> class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
>         <FileNamePattern>${testname}.%i.log</FileNamePattern>
>         <MinIndex>1</MinIndex>
>         <MaxIndex>1</MaxIndex>
>       </rollingPolicy>
>       <triggeringPolicy
> class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
>         <MaxFileSize>5MB</MaxFileSize>
>       </triggeringPolicy>
>       <layout class="ch.qos.logback.classic.PatternLayout">
>         <Pattern>%d{ISO8601} - %msg%n</Pattern>
>       </layout>
>     </appender>
>   </sift>
>  </appender>
>  <root level="error">
>   <appender-ref ref="RootSiftAppender" />
>  </root>
> </configuration>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>
>


More information about the Logback-user mailing list