Skip to content

Instantly share code, notes, and snippets.

@vrdhn
Created November 24, 2022 15:43
Show Gist options
  • Save vrdhn/aa021b2ec8996d194cfc1debf9628ea7 to your computer and use it in GitHub Desktop.
Save vrdhn/aa021b2ec8996d194cfc1debf9628ea7 to your computer and use it in GitHub Desktop.
implementation("org.apache.logging.log4j:log4j-api:2.19.0")
implementation("org.apache.logging.log4j:log4j-core:2.19.0")
private static final Logger LOG = LogManager.getLogger(Main.class);
private static void setLogLevel(Level level) {
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
LoggerConfig loggerConfig = ctx.getConfiguration().getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
loggerConfig.setLevel(level);
ctx.updateLoggers();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment