The log is an essential feature for each java application, and log4j is one of many uses. Generally, we use the java code logger.info(“Hello World”); to log a String value. it will output “Hello World” in the appender destination.
You have learned that there are a lot of objects inside log4j, such as Logger object, Layout object, and Appender object. But before you can use them in your java project, you should configure them commonly through a configuration file. This article will show you how to configure them.
Log4j is a java logging framework that is fast, reliable, and flexible. It is open-source and free. You can click here to go to it’s official home page.
Log4j is designed in a multiple-layer pattern. So there are multiple layers in it. And each layer has a different object to perform different actions. The below picture is a general view of all objects contained in log4j, we will introduce them one by one.