ppkarwasz commented on issue #3621:
URL: 
https://github.com/apache/logging-log4j2/issues/3621#issuecomment-2969304754

   Hi @Class-New,
   
   Thanks for the report! I may have misunderstood the nature of your problem, 
so please correct me if I did.
   
   Here’s a quick overview of how the two triggering policies work:
   
   * **`TimeBasedTriggeringPolicy`** rolls over *synchronously*—when the 
**first log event** of the new day is written. So the rollover happens only 
after that first event, meaning no event from the new day will end up in the 
old file. It uses the timezone from your `%d` pattern (typically your system 
timezone).
   
   * **`CronTriggeringPolicy`** rolls over *asynchronously* at the exact 
scheduled time (e.g., midnight), regardless of log activity. Due to its async 
nature, events close to the scheduled time might end up in either the old or 
new file. It uses the system’s default timezone.
   
   Two more details that matter in your setup:
   
   * The `Routing` appender creates its actual appenders **lazily**—only when a 
log event with a given `ROUTINGKEY` occurs. So if no event is logged for a key 
on a given day, its appender (and therefore the rollover logic) is never 
initialized, and no rollover will happen at the end of that day.
   
   * The definition of “end of day” depends on the timezone used. Since most 
timezones differ from UTC by full hours, timezone mismatches are less 
noticeable with minute- or hourly-based schedules—but they can cause confusion 
with daily rollovers if the timezone isn’t configured as expected.
   
   Could you clarify which of these behaviors isn’t working as expected, or 
what you believe might be a bug?
   
   


-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to