Re: Difference between the Date lookup $${date:yyyy-MM} and the Format Specifier %d{yyyy-MM}?

2022-09-02 Thread Matt Sicker
There’s also the fact that lookups are usable in layouts that don’t reuse 
pattern layout components. Note that there are also differences in how objects 
are allocated for different plugins when GC-free logging is a concern.

—
Matt Sicker

> On Sep 2, 2022, at 00:47, Piotr P. Karwasz  wrote:
> 
> Hi Rick,
> I gave a longer answer about this a couple of months ago on StackOverflow:
> 
> https://stackoverflow.com/q/71862896/11748454
> 
> Basically the delayed lookup `$${date:...}` uses the current time,
> when the rollover occurs, while the pattern `%d{...}` uses the date of
> the previous rollover.
> 
> A `RollingFileAppender` also uses the first (and hopefully only)
> pattern it finds to determine the rollover frequency.
> 
> Piotr
> 
>> On Fri, 2 Sept 2022 at 06:21, Rick  wrote:
>> 
>> Hi,
>> 
>> I am new to Log4j2, and I am a little bit confused with the Date lookup
>> $${date:-MM} and the Format Specifier %d{-MM}.
>> Please see the following configuration:
>> 
>> > filePattern="logs/*$${date:-MM}*/app-*%d{MM-dd-}*-%i.log.gz">
>> 
>> 
>> --
>> 
>> Sincerely,
>> 
>> *Rick Qin*
>> Email: rickq...@gmail.com
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 


Re: Difference between the Date lookup $${date:yyyy-MM} and the Format Specifier %d{yyyy-MM}?

2022-09-01 Thread Piotr P. Karwasz
Hi Rick,
I gave a longer answer about this a couple of months ago on StackOverflow:

https://stackoverflow.com/q/71862896/11748454

Basically the delayed lookup `$${date:...}` uses the current time,
when the rollover occurs, while the pattern `%d{...}` uses the date of
the previous rollover.

A `RollingFileAppender` also uses the first (and hopefully only)
pattern it finds to determine the rollover frequency.

Piotr

On Fri, 2 Sept 2022 at 06:21, Rick  wrote:
>
> Hi,
>
> I am new to Log4j2, and I am a little bit confused with the Date lookup
> $${date:-MM} and the Format Specifier %d{-MM}.
> Please see the following configuration:
>
>  filePattern="logs/*$${date:-MM}*/app-*%d{MM-dd-}*-%i.log.gz">
>
>
> --
>
> Sincerely,
>
> *Rick Qin*
> Email: rickq...@gmail.com

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org