'How to get current logger date format pattern in log4j2?

I want to get my current logger format pattern dynamically, how can I get it?



Solution 1:[1]

I'm curious what the use case is. Try this out. :)

final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
final Configuration config = ctx.getConfiguration();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Leonhard Printz