Re: Issue after moving to log4j 2.19

"Piotr P. Karwasz" <[email protected]> Fri, 14 Oct 2022 17:23:12 +0200
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <CAFmygFb38WT_Q3fDMaz17Qm+txPdVtuBRfbWQtUkL3y7bSD6sg@mail.gmail.com>
Hi Joan,

> After making a lot of tests trying to get this working again, we had to change the line below:
>
> this.systemLog = LogManager.getLogger("LOGGER_SYSTEM");
>
>  �
>
> By this:
>
> this.systemLog = LogManager.getContext().getLogger("LOGGER_SYSTEM");

This looks like a `LoggerContextSelector` problem:
https://logging.apache.org/log4j/2.x/manual/extending.html#ContextSelector

`LogManager.getContext()` should not be used, because it gives you the
wrong logger context most of the time.
 The automatic configuration uses `LogManager.getContext(false)` to
retrieve the right logger context.

Can you run your application with `-Dlog4j2.debug=true` and share the output?

Piotr