[logback-user] HELP! Need help while deleting logback file (broken symlink - Linux)

Ceki Gülcü ceki at qos.ch
Wed Jun 21 10:55:40 CEST 2023


Hi Arnaud,

I suggest that rolling be made using  TimeBasedRollingPolicy [1] or with
SizeAndTimeBasedRollingPolicy [2]. These two rolling policies do NOT
rename or move files so that the issues you describe do not occur.

In contrast, FixedWindowRollingPolicy renames files which can cause
problems such as the one you describe.


[1] https://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy
[2]
https://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy

-- 
Ceki Gülcü

Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch


On 6/21/2023 10:38 AM, Arnaud B. via logback-user wrote:
> Hello,
> 
> I need your help in creating log files by LOGBACK (v 1.1.4) on LINUX
> environment.
> 
> When starting the application server, it generates symbolic links between
> /proc/<PID>/fd/<NUM> to /appli/test/log/server_fonc.log,
> appli/test/log/application.log, ...
> 
> When using the LOGBACK rollover, for example, on the hast file, the
> application.log.5 file is deleted but it nevertheless generated a symbolic
> link between "/proc/<PID>/fd/<NUM>" and "/appli/test/log/application.log.5".
> 
> Suddenly, I end up with a broken symbolic link and a message
> "/appli/test/log/application.log.5 (deleted)" via the command "lsof -nP
> +L1 | grep java"
> 
> For what? Is this a logback issue? Or, an OS problem? Any solution?
> Thank you in advance for your help ;)
> 
> Example Configuration Logback for server_fonc.log :
>       <appender
> name="GENERAL_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
>              <file>/application/test/log/applicatif.log</file>
>              <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> 
>                    <level>TRACE</level>
>               </filter> 
>               <encoder>
>                    <Pattern>%d;%level;%X{adresseIp};%X{sessionId};%X{Art
> ifactId};%X{Version};%logger;%marker;%m%n%ex{full}
>                   </Pattern> 
>                </encoder>
>              
>  <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
>                    
> <fileNamePattern>/appli/test/log/applicatif.log.%i</fileNamePattern>
>                     <minIndex>1</minIndex> 
>                     <maxIndex>5</maxIndex> 
>                 </rollingPolicy>
>                
> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
>                         <maxFileSize>10MB</maxFileSize> 
>                  </triggeringPolicy>
>         </appender>
> 
> Best,
> 
> Arnaud BOIN
> 


More information about the logback-user mailing list