[logback-user] Error while deleting logback

Ceki Gülcü ceki at qos.ch
Sat Jun 17 21:30:48 CEST 2023


Hello Supraja,


Here is what the documentation states:
------------------------

Multiple %d specifiers

It is possible to specify multiple %d specifiers but only one of which
can be primary, i.e. used to infer the rollover period. All other tokens
must be marked as auxiliary by passing the 'aux' parameter (see examples
below).

Multiple %d specifiers allow you to organize archive files in a folder
structure different than that of the roll-over period. For example, the
file name pattern shown below organizes log folders by year and month
but roll-over log files every day at midnight.

/var/log/%d{yyyy/MM, aux}/myapplication.%d{yyyy-MM-dd}.log

----------------
Source:
https://logback.qos.ch/manual/appenders.html#tbrpFileNamePattern


Notice that the secondary (aux) %d specifier given before the primary
specifier. The secondary specifier is used to create folders.

Have you tried that?


-- 
Ceki Gülcü

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

On 6/14/2023 11:29 AM, supraja prabhakaran via logback-user wrote:
> Am using logback.xml to generate logs.Trying to delete the created
> logfile greater than 10 ( will have 10 logs files ) and delete oldest
> file from server. Creating the log file for every min.
> 
> 
> 
> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
> <fileNamePattern>${LOGS}/archived/spring-boot-logger.%d{yyy-MM-dd_HH-mm}_%d{HHmmss,aux}.log
> </fileNamePattern>
> <maxhistory>10</maxhistory>
> </rolling policy>
> 
> issue : when I have this %d{HHmmss,aux} the log file are not deleting
> and keeps generating in the server. After I remove that command it
> deleting files
> 


More information about the logback-user mailing list