Modern application Logging with Log4j2
After 20 years of evolution in the Java ecosystem, the ways of Logging have seen different strategies, trends, and architectures. Nowadays, several Logging frameworks can be found among the used third-party dependencies. We must support them all to debug an application or to trace runtime events.
Getting ready
This recipe provides a future-proof implementation of Log4j2 for the CloudStreet Market application. It requires several Maven dependencies to be added to our modules. As a solution, it can appear quite complicated, but in reality the amount of Logging frameworks to support is limited, and the logic behind a Log4j2 migration is fairly straightforward.
How to do it…
The following Maven dependencies have been added to the dependency-management section of the parent-module (
cloudstreetmarket-parent):<!-- Logging dependencies --> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j...