Mirror of Apache Logging Log4J2
Java Other
Clone or download
Permalink
Failed to load latest commit information.
.mvn/wrapper Add missing license headers Feb 26, 2017
log4j-1.2-api Apply ThreadContextRule to Log4j1XmlLayoutTest Jun 12, 2018
log4j-api-java9 [LOG4J2-2306] Compile with Error Prone for static analysis Apr 5, 2018
log4j-api [LOG4J2-2376] Optimize XML escape functionality and add unit testing. Jul 16, 2018
log4j-appserver LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-bom [LOG4J2-2237] Move Jackson-based layouts to their own modules: JSON, Feb 20, 2018
log4j-cassandra LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-core-its [LOG4J2-2306] Compile with Error Prone for static analysis Apr 5, 2018
log4j-core-java9 Update POM version to 3.0.0-SNAPSHOT since we now have a 2.x-release Jan 30, 2018
log4j-core Add miising arg. Jul 16, 2018
log4j-couchdb LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-csv [LOG4J2-2306] Compile with Error Prone for static analysis Apr 5, 2018
log4j-distribution LOG4J2-2305 - Create separate implementation for SLF4J 1.8 Jul 6, 2018
log4j-flume-ng [LOG4J2-2306] Compile with Error Prone for static analysis Apr 5, 2018
log4j-iostreams LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-jcl LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-jdbc-dbcp2 Various fixes to the site build Apr 8, 2018
log4j-jdbc [LOG4J2-2300] PoolingDriverConnectionSource does not take into account Mar 30, 2018
log4j-jeromq LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-jms Make constant public for log4j-server module. Jun 5, 2018
log4j-jmx-gui LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-jpa Better module description. Mar 9, 2018
log4j-jul LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-kafka [LOG4J2-2306] Compile with Error Prone for static analysis Apr 5, 2018
log4j-layout-jackson-json LOG4J2-2312 LOG4J2-2341 Fix jackson layout with async loggers Jul 3, 2018
log4j-layout-jackson-xml Various fixes to the site build Apr 8, 2018
log4j-layout-jackson-yaml Various fixes to the site build Apr 8, 2018
log4j-layout-jackson LOG4J2-2312 LOG4J2-2341 Fix jackson layout with async loggers Jul 3, 2018
log4j-liquibase LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-mongodb2 Now that we are on Java 8, we do not need to keep the test set up that Mar 1, 2018
log4j-mongodb3 Now that we are on Java 8, we do not need to keep the test set up that Mar 1, 2018
log4j-osgi LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-perf Benchmarks for StringBuilders escapeJson/escapeXml Jul 16, 2018
log4j-samples Update POM version to 3.0.0-SNAPSHOT since we now have a 2.x-release Jan 30, 2018
log4j-slf4j-impl LOG4J2-2305 - Create separate implementation for SLF4J 1.8 Jul 6, 2018
log4j-slf4j18-impl LOG4J2-2305 - Create separate implementation for SLF4J 1.8 Jul 6, 2018
log4j-smtp LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-taglib LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-to-slf4j LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
log4j-web [LOG4J2-1721] Allow composite configuration for context parameter Jul 3, 2018
src [LOG4J2-2376] Optimize XML escape functionality and add unit testing. Jul 16, 2018
.dockerignore Add missing license headers Jan 29, 2017
.gitattributes Add maven wrapper script Feb 13, 2017
.gitignore Ignore .toDelete and .factorypath. Jul 30, 2017
.travis-toolchains.xml Update travis config Apr 8, 2018
.travis.yml Enable dependency caching in travis Apr 8, 2018
BUILDING.md CLIRR check must be run after install. Sep 18, 2017
CONTRIBUTING.md Fix grammar in CONTRIBUTING.md Jan 29, 2017
Dockerfile [LOG4J2-1950] Fix docker build with jdk9 requirements. Closes #84. Jun 26, 2017
Jenkinsfile Add IBM JDK testing to jenkins pipeline Apr 8, 2018
LICENSE.txt Change instances of Log4j 2.0 to Log4j2. Create distribution subproject Mar 25, 2012
NOTICE.txt LOG4J2-2011 replace JCommander command line parser with picocli to le… Aug 14, 2017
README.md Fix another typo Nov 13, 2017
RELEASE-NOTES.md [LOG4J2-2233] Move JDBC code to a new module log4j-jdbc. Jan 29, 2018
checkstyle-header.txt Started adding documentation. Start fixing checkstyle errors Sep 6, 2011
checkstyle-import-control.xml Checkstyle police Jul 7, 2013
checkstyle-suppressions.xml Add missing license header. Sep 29, 2014
checkstyle.xml Checkstyle: SUPPRESS doesn't seem to work... Sep 27, 2015
mvnw Try out specifying bash in mvnw to make Jenkins happy Feb 13, 2017
mvnw.cmd Revert "Fix more quotes" Feb 13, 2017
pom.xml LOG4J2-2305 - Create separate implementation for SLF4J 1.8 Jul 6, 2018
spotbugs-exclude-filter.xml LOG4J2-2255 - Use Spotbugs instead of Findbugs. Minimum version is Ja… Feb 17, 2018
toolchains-docker.xml [LOG4J2-1950] Fix docker build with jdk9 requirements. Closes #84. Jun 26, 2017
toolchains-jenkins-ibm.xml Add IBM JDK testing to jenkins pipeline Apr 8, 2018
toolchains-jenkins-ubuntu.xml Add Windows Jenkins pipeline Apr 7, 2018
toolchains-jenkins-win.xml Fix java 9 path Apr 7, 2018
toolchains-sample-linux.xml Sample toolchains.xml for Linux May 5, 2017
toolchains-sample-mac.xml Update the build help for Windows and Mac example toolchains. May 5, 2017
toolchains-sample-win.xml Update sample tool chain file with current release. Jul 19, 2017

README.md

Apache Log4j 2

Apache Log4j 2 is an upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.

Jenkins Status Travis Status Maven Central

Pull Requests on Github

By sending a pull request you grant the Apache Software Foundation sufficient rights to use and release the submitted work under the Apache license. You grant the same rights (copyright license, patent license, etc.) to the Apache Software Foundation as if you have signed a Contributor License Agreement. For contributions that are judged to be non-trivial, you will be asked to actually signing a Contributor License Agreement.

Usage

Users should refer to Maven, Ivy, Gradle, and SBT Artifacts on the Log4j web site for instructions on how to include Log4j into their project using their chosen build tool.

Basic usage of the Logger API:

package com.example;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

public class Example {
    private static final Logger LOGGER = LogManager.getLogger();

    public static void main(String... args) {
        String thing = args.length > 0 ? args[0] : "world";
        LOGGER.info("Hello, {}!", thing);
        LOGGER.debug("Got calculated value only if debug enabled: {}", () -> doSomeCalculation());
    }

    private static Object doSomeCalculation() {
        // do some complicated calculation
    }
}

And an example log4j2.xml configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
  <Appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
    </Console>
  </Appenders>
  <Loggers>
    <Logger name="com.example" level="INFO"/>
    <Root level="error">
      <AppenderRef ref="Console"/>
    </Root>
  </Loggers>
</Configuration>

Documentation

The Log4j 2 User's Guide is available here or as a downloadable PDF.

Requirements

Log4j 2.4 and greater requires Java 7, versions 2.0-alpha1 to 2.3 required Java 6. Some features require optional dependencies; the documentation for these features specifies the dependencies.

License

Apache Log4j 2 is distributed under the Apache License, version 2.0.

Download

How to download Log4j, and how to use it from Maven, Ivy and Gradle. You can access the latest development snapshot by using the Maven repository https://repository.apache.org/snapshots, see Snapshot builds.

Issue Tracking

Issues, bugs, and feature requests should be submitted to the JIRA issue tracking system for this project.

Pull request on GitHub are welcome, but please open a ticket in the JIRA issue tracker first, and mention the JIRA issue in the Pull Request.

Building From Source

Log4j requires Apache Maven 3.x. To build from source and install to your local Maven repository, execute the following:

mvn install

Contributing

We love contributions! Take a look at our contributing page.