How to get Log4j

suggest change

Log4j 2

The coordinates below are Log4j 2.6.2, a 2016 release, not a current one. Versions from 2.0-beta9 through 2.14.1 are affected by CVE-2021-44228 (Log4Shell). Use a fixed 2.x release rather than copying 2.6.2.

Using Maven:

Add the following dependency to pom.xml (that filename is case-sensitive on many systems):

<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'
}

Gradle 7 removed the compile configuration. Later builds declare these with implementation.


Getting log4j 1.x


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


Using Maven:

Declare this dependency in pom.xml:

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

Using Ivy:

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

Using 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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents