Stats

Contributors: 4 Friday, August 5, 2016
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

How to get Log4j

Download java eBook

Example

Current version (log4j2)

Using Maven:
Add the following dependency to your POM.xml file:

<dependencies>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.6.2</version>
  </dependency>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.6.2</version>
  </dependency>
</dependencies>

Using Ivy:

<dependencies>
  <dependency org="org.apache.logging.log4j" name="log4j-api" rev="2.6.2" />
  <dependency org="org.apache.logging.log4j" name="log4j-core" rev="2.6.2" />
</dependencies>

Using Gradle:

dependencies {
  compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.6.2'
  compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.6.2'
}

Getting log4j 1.x


Note: Log4j 1.x has reached End-of-Life (EOL) (see Remarks).


Using Maven:

Declare this dependency in the POM.xml file:

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

Using Ivy:

<dependency org="log4j" name="log4j" rev="1.2.17"/>

Usign Gradle:

compile group: 'log4j', name: 'log4j', version: '1.2.17'

Using Buildr:

'log4j:log4j:jar:1.2.17'

Adding manually in path build:

Download from Log4j website project