This project shows how to write a custom lookup.
In order to use it:
-
install the artifact and its parent locally with
mvn install, -
add it to your Maven project:
<dependency> <groupId>org.apache.logging.log4j.samples</groupId> <artifactId>log4j-samples-loggerProperties</artifactId> <version>2.19.1-SNAPSHOT</version> </dependency>
-
use
$${custom:some_key}in the pattern of your pattern layout, -
in your code assign some properties to a logger using
CustomLookup#setLoggerProperties.