Re: Deprecation of Log4j Supplier in 2.x...why? 😪

"Piotr P. Karwasz" <[email protected]> Fri, 15 Mar 2024 07:29:10 +0100
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <CAFmygFYS=Y544ydgCY3egSxTOpQyVA6s7tNbAEjganc5dU93qA@mail.gmail.com>
Hi Jeff,

On Fri, 15 Mar 2024 at 02:43, <[email protected]> wrote:
> One of the great new features of Log4j2 is the lambda lazy logging.
>
> Since we migrated to Log4j2 we have liberally been trying to take advantage of this where we can.
>
> In the last few releases though, in preparation for Log4j 3.x the Log4j Supplier has been deprecated without replacement.

Sorry, if we were not specific enough in the Javadoc[1]. We would like
to replace `org.apache.logging.log4j.util.Supplier` with
`java.util.function.Supplier`, which is a source compatible change:
the compiler will just convert lambdas to another interface.

However this is more of a very long-term plan, which would probably
require an entirely new package name and `Logger` interface.
Effectively we should remove the `@Deprecated` annotation from our
code and just keep the Javadoc description.

Piotr

[1] https://logging.apache.org/log4j/2.x/javadoc/log4j-api/org/apache/logging/log4j/util/Supplier.html