Last active
September 7, 2022 09:04
-
-
Save jasonheecs/d2429e4d96b3192bf4eda791c92a195b to your computer and use it in GitHub Desktop.
Sample configuration to inject a TestAppender into log4j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Configuration status="WARN"> | |
<Properties> | |
<Property name="LOG_PATTERN"> | |
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n | |
</Property> | |
</Properties> | |
<Appenders> | |
<Console name="Console" target="SYSTEM_OUT"> | |
<PatternLayout pattern="${LOG_PATTERN}" /> | |
</Console> | |
<TestAppender name="TestAppender"> | |
<PatternLayout pattern="${LOG_PATTERN}" /> | |
</TestAppender> | |
</Appenders> | |
<Loggers> | |
<Root level="info" additivity="false"> | |
<AppenderRef ref="Console" /> | |
<AppenderRef ref="TestAppender" level="error" /> | |
</Root> | |
</Loggers> | |
</Configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment