Nef91 opened a new issue, #2721:
URL: https://github.com/apache/logging-log4j2/issues/2721

   Hello, below is my login configuration file, the main assumptions are:
   - maximum 5 logs per day, 20 MB each
   - deleting logs older than 21 days
   - log backup every day at midnight
   
   `<?xml version="1.0" encoding="UTF-8"?>
   <Configuration status="warn">
       <Properties>
           <Property name="basePath">${sys:user.home}/.test/logs</Property>
       </Properties>
    
       <Appenders>
           <RollingFile name="fileLogger" fileName="${basePath}/console.log" 
filePattern="${basePath}/console_backup/console-%d{yyyy-MM-dd}_%i.log">
               <PatternLayout>
                   <pattern>%msg</pattern>
               </PatternLayout>
               <Policies>
                   <CronTriggeringPolicy schedule="00 00 00 * * ?"/>
                   <SizeBasedTriggeringPolicy size="20 MB"/>
               </Policies>
               <!-- Maximum number of backups -->
               <DefaultRolloverStrategy max="5">
                   <Delete basePath="${basePath}/console_backup">
                       <IfLastModified age="21d" />
                   </Delete>
               </DefaultRolloverStrategy>
           </RollingFile>
       </Appenders>
    
       <Loggers>
           <Logger name="name.john.doe.util.gui.ConsoleOutputStream" 
level="info" additivity="true">
               <appender-ref ref="fileLogger" level="info" />
           </Logger>
           <Root level="info" additivity="false">
               <appender-ref ref="console" />
           </Root>
       </Loggers>
   </Configuration>`
   
   According to the assumption, I would like the log backup to include the date 
of log creation, i.e. if I create a log on July 8, 2024, the log backup should 
contain the name 'console-2024-07-08_1.log' and it creates a backup with the 
date from the previous day (console -2024-07-07_1.log). After changing the 
logging policy and replacing CronTriggeringPolicy with the entry ' 
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>', it logs the correct 
date, but I would like to have more control over it, so I want to use 
CronTriggeringPolicy. Please help me find what could be the cause.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to