Download and Add Log4j jars

Before starting the Log4j example first we need to add the Log4j jar file in our project. We can add Log4j jar dependency in our pom.xml under maven project. We can add below dependency:

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.17</version>
</dependency>

 
If we are not using any build tools, then we can download the log4j jar from Apache Log4j Official page and include into our project classpath.