LOG4J2-3573 Removed build page in favor of a single build instructions file.
5 files changed
tree: dbed28d9afad850a3759babc9b5095da721921c3
  1. .github/
  2. .mvn/
  3. docs/
  4. log4j-1.2-api/
  5. log4j-api/
  6. log4j-api-test/
  7. log4j-appserver/
  8. log4j-bom/
  9. log4j-cassandra/
  10. log4j-core/
  11. log4j-core-its/
  12. log4j-core-test/
  13. log4j-couchdb/
  14. log4j-csv/
  15. log4j-distribution/
  16. log4j-docker/
  17. log4j-flume-ng/
  18. log4j-gctests/
  19. log4j-iostreams/
  20. log4j-jakarta-web/
  21. log4j-jcl/
  22. log4j-jdbc/
  23. log4j-jdbc-dbcp2/
  24. log4j-jeromq/
  25. log4j-jms/
  26. log4j-jmx-gui/
  27. log4j-jndi/
  28. log4j-jndi-test/
  29. log4j-jpa/
  30. log4j-jpl/
  31. log4j-jul/
  32. log4j-kafka/
  33. log4j-kubernetes/
  34. log4j-layout-jackson/
  35. log4j-layout-jackson-json/
  36. log4j-layout-jackson-xml/
  37. log4j-layout-jackson-yaml/
  38. log4j-layout-template-json/
  39. log4j-layout-template-json-test/
  40. log4j-liquibase/
  41. log4j-mongodb3/
  42. log4j-mongodb4/
  43. log4j-osgi/
  44. log4j-perf/
  45. log4j-plugin-processor/
  46. log4j-plugins/
  47. log4j-plugins-test/
  48. log4j-redis/
  49. log4j-samples/
  50. log4j-script/
  51. log4j-slf4j-impl/
  52. log4j-slf4j18-impl/
  53. log4j-smtp/
  54. log4j-spring-boot/
  55. log4j-spring-cloud-config/
  56. log4j-taglib/
  57. log4j-to-jul/
  58. log4j-to-slf4j/
  59. log4j-web/
  60. src/
  61. .asf.yaml
  62. .gitattributes
  63. .gitignore
  64. .java-version
  65. BUILDING.md
  66. checkstyle-header.txt
  67. checkstyle-import-control.xml
  68. checkstyle-suppressions.xml
  69. checkstyle.xml
  70. CODE_OF_CONDUCT.md
  71. CONTRIBUTING.md
  72. LICENSE.txt
  73. mvnw
  74. mvnw.cmd
  75. NOTICE.txt
  76. pom.xml
  77. README.md
  78. RELEASE-NOTES.md
  79. SECURITY.md
  80. spotbugs-exclude-filter.xml
README.md

Apache Log4j 3.x

Apache Log4j 3.x 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.

GitHub build (3.x) GitHub build (2.x) Latest Maven Central release

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 sign 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 3.x User's Guide is available here or as a downloadable PDF.

Requirements

Log4j 3.0 and greater requires Java 11. Some features require optional dependencies; the documentation for these features specifies the dependencies.

License

Apache Log4j 3.x 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 requests 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

See the detailed build instructions on how to build to the project and website from sources.

Contributing

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