Components
The Log4j 2 distribution contains the following artifacts:
log4j-bom
A public Bill-of-Materials that manages all the versions of Log4j artifacts. You can import the BOM in your build tool of preference:
-
Maven
-
Gradle
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-bom</artifactId>
<version>2.24.1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
dependencies {
implementation platform('org.apache.logging.log4j:log4j-bom:2.24.1')
}
log4j
A private Bill-of-Materials used during the compilation and testing of the project.
Do not use this artifact, since it also manages versions of third-party projects.
Use |
log4j-1.2-api
JPMS module |
|
---|
The log4j-1.2-api
artifact contains several tools to help users migrate from Log4j 1 to Log4j 2.
See Log4j 1 to Log4j 2 Bridge for details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-1.2-api'
log4j-api
JPMS module |
|
---|
The log4j-api
artifact contains the Log4j API.
See Log4j API for more details.
-
Maven
-
Gradle
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j-api.version}</version>
</dependency>
implementation 'org.apache.logging.log4j:log4j-api:${log4j-api.version}'
log4j-api-test
JPMS module |
|
---|
The log4j-api-test
artifact contains test fixtures useful to test Log4j API implementations.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api-test</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-api-test'
log4j-appserver
JPMS module |
|
---|
The log4j-appserver
artifact contains:
-
A bridge from Tomcat JULI to the Log4j API. See Replacing Tomcat logging system for more information.
-
A bridge from Jetty 9 logging API to the Log4j API. See Replacing Jetty logging system for more information
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-appserver</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-appserver'
log4j-cassandra
JPMS module |
|
---|
The log4j-cassandra
artifact contains an appender for the
Apache Cassandra
database.
See Cassandra Appender for more information.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-cassandra</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-cassandra'
log4j-core
JPMS module |
|
---|
The log4j-core
artifact contains the reference implementation of the Log4j API.
See Reference implementation for more details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-core'
log4j-core-test
JPMS module |
|
---|
The log4j-core-test
artifact contains test fixtures useful to extend the reference implementation.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core-test</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-core-test'
log4j-couchdb
JPMS module |
|
---|
The log4j-couchdb
artifact contains a provider to connect the
NoSQL Appender
with the
Apache CouchDB
database.
See CouchDB provider for more information.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-couchdb</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-couchdb'
log4j-docker
JPMS module |
|
---|
The log4j-docker
artifact contains a lookup for applications running in a
Docker container
See Docker lookup for more information.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-docker</artifactId>
<version>2.24.1</version>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-docker:2.24.1'
log4j-flume-ng
JPMS module |
|
---|
The log4j-flume-ng
artifact contains an appender for the
Apache Flume
log data collection service.
See Flume Appender for more information.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-flume-ng</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-flume-ng'
log4j-iostreams
JPMS module |
|
---|
The log4j-iostreams
artifact is an extension of the Log4j API to connect with legacy stream-based logging methods.
See Log4j IOStreams for more information.
log4j-jakarta-smtp
JPMS module |
|
The log4j-jakarta-smtp
contains an appender for the
Jakarta Mail 2.0 API
and later versions.
See SMTP Appender for more information.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jakarta-smtp</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-jakarta-smtp'
log4j-jakarta-web
JPMS module |
|
The log4j-jakarta-web
contains multiple utils to run your applications in a
Jakarta Servlet 5.0
or later environment:
-
It synchronizes the lifecycle of Log4j Core and your application. See Integrating with web applications for more details.
-
It contains a lookup for the data contained in a Servlet context. See Web Lookup for more details.
-
It contains an appender to forward log event to a Servlet. See Servlet Appender for more details.
Don’t deploy this artifact together with |
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jakarta-web</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-jakarta-web'
log4j-jcl
JPMS module |
|
The log4j-jcl
artifact contains a bridge from
Apache Commons Logging
and the
Log4j API.
See Installing JCL-to-Log4j API bridge for more details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-jcl'
log4j-jdbc-dbcp2
JPMS module |
|
The log4j-jdbc-dbcp2
artifact contains a data source for the
JDBC Appender
that uses
Apache Commons DBCP.
See PoolingDriver
connection source for more details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jdbc-dbcp2</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-jdbc-dbcp2'
log4j-jpa
JPMS module |
|
The log4j-jpa
artifact contains an appender for the
Jakarta Persistence 2.2 API
or Java Persistence API.
See JPA Appender for more details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jpa</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-jpa'
log4j-jpl
JPMS module |
|
The log4j-jpl
artifact contains a bridge from
System.Logger
to the Log4j API.
See Installing the JPL-to-Log4j API bridge for more details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jpl</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-jpl'
log4j-jul
JPMS module |
|
The log4j-jul
artifact contains a bridge from
java.util.logging
to the Log4j API.
See Installing the JUL-to-Log4j API bridge for more details.
Don’t deploy this artifact together with |
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jul</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-jul'
log4j-layout-template-json
JPMS module |
|
The log4j-layout-template-json
contains a highly extensible and configurable
layout
to format log events as JSON.
See JSON Template Layout for details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-template-json</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-layout-template-json'
log4j-mongodb
JPMS module |
|
---|
The log4j-mongodb
artifact contains a provider to connect the
NoSQL Appender
with the
MongoDB
database.
It is based on the latest version of the Java driver.
See MongoDb provider for more information.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-mongodb</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-mongodb4'
log4j-mongodb4
JPMS module |
|
---|
The log4j-mongodb
artifact contains a provider to connect the
NoSQL Appender
with the
MongoDB
database.
It is based on version 4.x of the Java driver.
See MongoDb4 provider for more information.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-mongodb4</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-mongodb4'
log4j-slf4j2-impl
JPMS module |
|
---|
The log4j-slf4j2-impl
artifact contains a bridge from
SLF4J 2 API
to the Log4j API.
See Installing the SLF4J-to-Log4j API bridge for more details.
Don’t deploy this artifact together with either |
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl'
log4j-slf4j-impl
JPMS module |
|
---|
The log4j-slf4j-impl
artifact contains a bridge from
SLF4J 1 API
to the Log4j API.
See Installing the SLF4J-to-Log4j API bridge for more details.
Don’t deploy this artifact together with either |
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
log4j-spring-boot
JPMS module |
|
---|
The log4j-spring-boot
artifact contains multiple utils to integrate with
Spring Framework 5.x
or earlier versions and
Spring Boot 2.x
or earlier versions.
-
It provides a property source. See Spring Property source for more details.
-
It provides a lookup. See Spring lookup for more details.
-
It provides an arbiter. See Spring arbiter for more details.
-
It provides an alternative
LoggingSystem
implementation. See Log4j Spring Boot Support for more details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-spring-boot</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-spring-boot'
log4j-spring-cloud-config-client
JPMS module |
|
---|
The log4j-spring-cloud-config-client
provides utils to integrate with
Spring Cloud Config 3.x
or earlier versions.
See Log4j Spring Cloud Configuration for more details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-spring-cloud-config-client</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-spring-cloud-config-client'
log4j-taglib
JPMS module |
|
---|
The log4j-taglib
provides a
Jakarta Servlet Pages 2.3
or earlier library that logs to the Log4j API.
See Log4j Taglib for more details.
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-taglib</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-taglib'
log4j-to-jul
JPMS module |
|
The log4j-jul
artifact contains an implementation of the
Log4j API
that logs to
java.util.logging
.
See Installing JUL for more details.
Don’t deploy this artifact together with |
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-jul</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-to-jul'
log4j-to-slf4j
JPMS module |
|
See Installing Logback for more details.
Don’t deploy this artifact together with either |
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-to-slf4j'
log4j-web
JPMS module |
|
The log4j-jakarta-web
contains multiple utils to run your applications in a
Jakarta Servlet 4.0
or Java EE Servlet environment:
-
It synchronizes the lifecycle of Log4j Core and your application. See Integrating with web applications for more details.
-
It contains a lookup for the data contained in a Servlet context. See Web Lookup for more details.
-
It contains an appender to forward log event to a Servlet. See Servlet Appender for more details.
Don’t deploy this artifact together with |
-
Maven
-
Gradle
We assume you use log4j-bom
for dependency management.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<scope>runtime</scope>
</dependency>
We assume you use log4j-bom
for dependency management.
runtimeOnly 'org.apache.logging.log4j:log4j-web'