Implement log4j using Maven and JUnit

Logging is very important for any project. Let’s see the steps to implement in your maven project.

Step 1: Add dependency in pom.xml file

Step 2: Create log4j.properties file. Generally it comes under src/test/resources

Step 3: Implement it in Java class

Step 4: Call you Runner Junit class

Now, run your junit class and see the log in both console and log file.

More on Logging
1. How to implement logging(log) in Java
2. log4j.properties Examples

Please share your feedback. Also, contact at online.nimit@gmail.com for more details.

Leave a Reply

Your email address will not be published. Required fields are marked *