[logback-user] deleting the log file stops logging

David Roussel nabble at diroussel.xsmail.com
Mon Mar 3 12:25:44 CET 2014


Is this on Unix? On windows you wouldn't be able to delete the file. 

On unix if you delete a file and another process is writing to it, then the file still exists until it is closed. So logback does not know the file has been deleted. 

Just try to not delete it. 

David

> On 3 Mar 2014, at 10:41, Sumit Bhardwaj <sumit.bhardwaj at gmail.com> wrote:
> 
> Hi,
> 
> We are using logback version 0.9.29, and if the log file is accidently deleted then logback stops logging and it needs app server restart to resume logging.
> 
> is there anything I am missing?? Or is this the expected behaviour?
> 
> I have pasted my configuration below.
> 
> Regards,
> Sumit
> 
> <configuration scan="true">
> 
>         <contextName>MY_APP</contextName>
> 
> 
> 
>         <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
> 
>                 <!-- encoders are assigned the type
> 
>                          ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
> 
>                 <encoder>
> 
>                         <pattern>%d{yyyy-MM-dd HH:mm:ss} %contextName %logger [%5level] %msg%n</pattern>
> 
>                 </encoder>
> 
>                 <filter></filter>
> 
>         </appender>
> 
> 
> 
>         <!-- Size and time based archiving -->
> 
>         <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
> 
>                 <file>${MY_HOME}/logs/logfile.log</file>
> 
>                 <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
> 
>                         <maxFileSize>5MB</maxFileSize>
> 
>                 </triggeringPolicy>
> 
> 
> 
>                 <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
> 
>                         <fileNamePattern>${MY_HOME}/logs/logfile-%i.log</fileNamePattern>
> 
>                         <minIndex>1</minIndex>
> 
>                         <maxIndex>3</maxIndex>
> 
>                 </rollingPolicy>
> 
> 
> 
>                 <encoder>
> 
>                         <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger %5level - %msg%n</pattern>
> 
>                 </encoder>
> 
>         </appender>
> 
> 
> 
>          <logger name="org.springframework" level="WARN" additivity="false">
> 
>                 <appender-ref ref="FILE"/>
> 
>         </logger>
> 
> 
> 
>         <!-- For all other loggers in the system, output to console -->
> 
>         <root level="WARN">
> 
>                 <appender-ref ref="STDOUT" />
> 
>         </root>
> 
> </configuration>
> 
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20140303/c729ece3/attachment.html>


More information about the Logback-user mailing list