MCPcopy
hub / github.com/apache/logging-log4j2

github.com/apache/logging-log4j2 @log4j-2.13.3 sqlite

repository ↗ · DeepWiki ↗ · release log4j-2.13.3 ↗
15,836 symbols 65,009 edges 2,049 files 4,585 documented · 29%
README

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.

Extension points exported contracts — how you extend this code

RewritePolicy (Interface)
This interface is implemented to provide a rewrite strategy for RewriteAppender. RewriteAppender will call the rewrite [11 …
log4j-1.2-api/src/main/java/org/apache/log4j/rewrite/RewritePolicy.java
LoggerContextAccessor (Interface)
Provides access to a Core Logger Context. [11 implementers]
log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContextAccessor.java
FlumeEventFactory (Interface)
Factory to create Flume events. [8 implementers]
log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEventFactory.java
Marker (Interface)
Markers are objects that are used to add easily filterable information to log messages. Markers can be hierarchical - e [7 …
log4j-api/src/main/java/org/apache/logging/log4j/Marker.java
PreciseClock (Interface)
Extension of the Clock interface that is able to provide more accurate time information than milliseconds since [28 implementers]
log4j-core-java9/src/main/java/org/apache/logging/log4j/core/time/PreciseClock.java
LevelConverter (Interface)
Strategy interface to convert between custom Log4j Level Levels and JUL java.util.logging.Level Levels. [3 implementers]
log4j-jul/src/main/java/org/apache/logging/log4j/jul/LevelConverter.java
AuditEvent (Interface)
Interface that indicates the Class was generated by the DTOManager. [2 implementers]
log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/AuditEvent.java
Log4jWebSupport (Interface)
Specifies an interface for setting and clearing a thread-bound LoggerContext in a Java EE web application. Also [1 implementers]
log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebSupport.java

Core symbols most depended-on inside this repo

append
called by 1720
log4j-core/src/main/java/org/apache/logging/log4j/core/Appender.java
get
called by 1358
log4j-api/src/main/java/org/apache/logging/log4j/util/Supplier.java
toString
called by 992
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/nosql/NoSqlProvider.java
size
called by 799
log4j-api/src/main/java/org/apache/logging/log4j/util/ReadOnlyStringMap.java
debug
called by 687
log4j-api/src/main/java/org/apache/logging/log4j/Logger.java
put
called by 682
log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap.java
build
called by 500
log4j-core/src/main/java/org/apache/logging/log4j/core/util/Builder.java
error
called by 471
log4j-core/src/main/java/org/apache/logging/log4j/core/ErrorHandler.java

Shape

Method 13,220
Class 2,313
Interface 251
Enum 52

Languages

Java100%

Modules by API surface

log4j-core/src/main/java/org/apache/logging/log4j/core/tools/picocli/CommandLine.java347 symbols
log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDatePrinter.java95 symbols
log4j-api/src/test/java/org/apache/logging/log4j/LambdaLoggerTest.java85 symbols
log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java70 symbols
log4j-api/src/test/java/org/apache/logging/log4j/LoggerTest.java67 symbols
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractJacksonLayout.java62 symbols
log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java62 symbols
log4j-api/src/test/java/org/apache/logging/log4j/util/SortedArrayStringMapTest.java61 symbols
log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java61 symbols
log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java58 symbols
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcDatabaseManager.java58 symbols
log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java58 symbols

Dependencies from manifests, versioned

ch.qos.logback:logback-classic
ch.qos.logback:logback-core
com.datastax.cassandra:cassandra-driver-core3.1.4 · 1×
com.fasterxml.jackson.core:jackson-annotations
com.fasterxml.jackson.core:jackson-core
com.fasterxml.jackson.dataformat:jackson-dataformat-xml
com.fasterxml.jackson.dataformat:jackson-dataformat-yaml
com.fasterxml.jackson.datatype:jackson-datatype-jsr310
com.fasterxml.jackson.module:jackson-module-jaxb-annotations
com.fasterxml.woodstox:woodstox-core5.0.3 · 1×

Datastores touched

(mysql)Database · 1 repos
exampleDbDatabase · 1 repos

For agents

$ claude mcp add logging-log4j2 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact