Created
March 21, 2023 16:18
-
-
Save david-bakin-sl/7f458ac55a890be99c1763b60f14a603 to your computer and use it in GitHub Desktop.
Remove all log4j2 appenders
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
private void removeLogging() { | |
final var ctx = (org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false); | |
final var configuration = (AbstractConfiguration) ctx.getConfiguration(); | |
final var allAppenders = configuration.getAppenders(); | |
for (final var appenderName : allAppenders.keySet()) { | |
configuration.removeAppender(appenderName); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment