Hi Jeff,

On Fri, 11 Nov 2022 at 15:58, <jeffrey.tho...@t-systems.com> wrote:
> I just discovered the Junit hooks and have been using them out in my test 
> code - nice way of testing logging with a clean context.

Can you provide an example on how you use the JUnit extensions in your
application test code?

The JUnit extensions used in Log4j2 are mostly useless, when testing
applications: applications usually use static loggers (Log4j2
internally only uses StatusLogger), which will be bound to the logger
context used at the moment of their static initialization. Subsequent
LoggerContext reloads (as those caused by @LoggerContextSource) are
useless.

The only component that can be used to test applications is the ListAppender.

Piotr

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

Reply via email to