Log4j Runtime Dependencies

Some Log4J features depend on external libraries. This page lists the required and optional dependencies.

As of version 2.10.0 the Log4j API is a Java module (with a module-info.java). Many of the other jars are automatic modules. The characteristics of the modules are:

Artifact NameModule NameModule Characteristics
log4j-apiorg.apache.logging.log4j| Module Directive | Notes |
| exports org.apache.logging.log4j | |
| exports org.apache.logging.log4j.message | |
| exports org.apache.logging.log4j.simple | |
| exports org.apache.logging.log4j.spi | |
| exports org.apache.logging.log4j.spi | |
| exports org.apache.logging.log4j.util | Some classes in this package are used by the logging implementation and should be considered private. The module info definition may be modified in the future to export these only to the logging implmentation. |
| uses org.apache.logging.log4j.spi.Provider | Service that must be provided by the logging implementation. |
log4j-appserverorg.apache.logging.log4j.appserverAutomatic Module
log4j-cassandraorg.apache.logging.log4j.cassandraAutomatic Module
log4j-coreorg.apache.logging.log4j.coreAutomatic Module
log4j-couchdborg.apache.logging.log4j.couchdbAutomatic Module
log4j-dockerorg.apache.logging.log4j.dockerAutomatic Module
log4j-1.2-apiorg.apache.log4jAutomatic Module
log4j-flume-ngorg.apache.logging.log4j.flumeAutomatic Module
log4j-iostreamsorg.apache.logging.log4j.iostreamsAutomatic Module
log4j-jclorg.apache.logging.log4j.jclAutomatic Module
log4j-jmx-guiorg.apache.logging.log4j.jmx.guiAutomatic Module
log4j-julorg.apache.logging.log4j.julAutomatic Module
log4j-mongodborg.apache.logging.log4j.mongodbAutomatic Module
log4j-osgiorg.apache.logging.log4j.osgiAutomatic Module. Unclear how OSGi will support Java modules.
log4j-slf4j-implorg.apache.logging.log4j.slf4j.implAutomatic Module. May require renaming should SLF4J ever require all implementations to have the same module name.
log4j-tagliborg.apache.logging.log4j.taglibAutomatic Module
log4j-to-slf4jorg.apache.logging.log4j.slf4jAutomatic Module
log4j-weborg.apache.logging.log4j.webAutomatic Module

As of version 2.9.1 Log4j supports Java 9 but will still work in Java 7 or 8. In this version log4j-api is packaged as a multi-release jar and supports the use of the StackWalker and Process APIs.

As of version 2.4, Log4J requires Java 7.

Log4j version 2.3 and older require Java 6.

log4j-api

The Log4J API module has no external dependencies.

log4j-core

The Log4J Implementation has several optional dependencies. See the Dependency Tree for the exact list of JAR files needed for these features.

Optional Dependencies per Feature in Log4J Implementation

FeatureRequirements
XML configuration-
Properties configuration-
JSON configurationJackson core and databind
YAML configurationJackson databind and YAML data format
CSV LayoutApache Commons CSV
JSON LayoutJackson core and databind
XML LayoutJackson core, databind and dataformat XML
And com.fasterxml.woodstox:woodstox-core:5.0.2
YAML LayoutJackson core, databind and YAML data format
Async LoggersLMAX Disruptor
Kafka AppenderKafka client library. Note that you need to use a version of the Kafka client library matching the Kafka server used.
SMTP Appenderan implementation of javax.mail
JMS Appendera JMS broker like Apache ActiveMQ
Windows console color supportJansi
JDBC Appendera JDBC driver for the database you choose to write events to
JPA Appenderthe Java Persistence API classes, a JPA provider implementation, and a decorated entity that the user implements. It also requires an appropriate JDBC driver
NoSQL Appender with MongoDB providerMongoDB Java Client driver and Log4j MongoDB library
NoSQL Appender with Apache CouchDB providerLightCouch CouchDB client library and Log4j CouchDB library
Cassandra AppenderDatastax Cassandra driver and Log4j Cassandra library
Bzip2, Deflate, Pack200, and XZ compression on rolloverApache Commons Compress. In addition, XZ requires XZ for Java.
ZeroMQ AppenderThe ZeroMQ appender uses the JeroMQ library which is licensed under the terms of the Mozilla Public License Version 2.0 (MPLv2). For details see the file LICENSE included with the JeroMQ distribution.

log4j-docker

Log4j Docker Support requires Jackson annotations, core, and databind. See the Dependency Tree for the exact list of JAR files needed.

log4j-jcl

The Commons Logging Bridge requires Commons Logging. See the Dependency Tree for the exact list of JAR files needed.

log4j-1.2-api

The Log4j 1.2 Bridge has no external dependencies. This only requires the Log4j API. Including Log4j Core provides optional, extra functionality.

log4j-slf4j-impl

The Log4j 2 SLF4J Binding depends on the SLF4J API. See the Dependency Tree for the exact list of JAR files needed.

Do not use this with the log4j-to-slf4j module.

log4j-jul

The Log4j 2 Java Util Logging Adapter has no external dependencies. It optionally depends on the Log4j Core library. The only required module is the Log4j API.

log4j-to-slf4j

The Log4j 2 to SLF4J Adapter requires the SLF4J API and an SLF4J implementation. See the Dependency Tree for the exact list of JAR files needed.

Do not use this with the log4j-slf4j-impl module.

log4j-flume-ng

The Flume Appender requires Apache Flume and Apache Avro. The persistent agent uses Berkeley DB. See the Dependency Tree for the exact list of JAR files needed.

log4j-spring-cloud-config-client

Log4j Spring Cloud Config Client requires Spring Cloud Config. Spring Cloud Bus is required if notification of logging configuration changes is desired. Spring Boot is required but applications do not have to be packaged as a Spring Boot application. Dependency Tree for the exact list of JAR files needed.

log4j-taglib

The Log4j Log Tag Library requires the Jakarta Commons Log Taglib and the Servlet API. See the Dependency Tree for the exact list of JAR files needed.

log4j-jmx-gui

The Log4j JMX GUI requires the JConsole jar when run as a JConsole plugin. Otherwise it has no external dependencies. See the Dependency Tree for the exact list of JAR files needed.

log4j-web

The Log4j Web module requires the Servlet API. See the Dependency Tree for the exact list of JAR files needed. Note that this works with the Servlet 2.5 API as well as the Servlet 3.x API.

log4j-couchdb

The Log4J CouchDB module depends on the LightCouch CouchDB client library.

log4j-mongodb

The Log4J MongoDB module depends on the MongoDB Java Client driver.

log4j-cassandra

The Log4J Cassandra module depends on the Datastax Cassandra driver.

log4j-iostreams

The Log4j IO Streams module has no external dependencies. This only requires the Log4j API.

log4j-api-scala

The Log4j Scala API requires Scala runtime library and reflection in addition to the Log4j API.