Log is an essential feature for each java application, and log4j is one of many uses. Generally we use below java code to log a String value.logger.info(“Hello World”); 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 your 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 java logging framework which is fast, reliable and flexible. It is open source and free. You can click here to go to it’s home page.
Log4j is designed in multiple layer pattern. So there are multiple layers in it. And each layer has different object to perform different actions. Below picture is a general view of all objects contained in log4j, we will introduce them one by one.