
Product
Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
org.apache.logging.log4j:log4j
Advanced tools
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.
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.
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>
The Log4j 3.x User's Guide is available here or as a downloadable PDF.
Log4j 3.0 and greater requires Java 11. Some features require optional dependencies; the documentation for these features specifies the dependencies.
Apache Log4j 3.x is distributed under the Apache License, version 2.0.
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.
Issues, bugs, and feature requests should be submitted to the the issue tracking system for this project.
Pull requests on GitHub are welcome, but please open a ticket in the issue tracker first, and mention the issue in the pull request.
See the detailed build instructions on how to build to the project and website from sources.
We love contributions! Take a look at our contributing page.
FAQs
Apache Log4j Parent
We found that org.apache.logging.log4j:log4j demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.