use of org.jboss.logmanager.Logger in project quarkus by quarkusio.
the class LogController method updateLogLevel.
public static void updateLogLevel(String loggerName, String levelValue) {
LogContext logContext = LogContext.getLogContext();
Logger logger = logContext.getLogger(loggerName);
java.util.logging.Level level;
if (levelValue == null || levelValue.isBlank()) {
if (logger.getParent() != null) {
level = logger.getParent().getLevel();
} else {
throw new IllegalArgumentException("The level of the root logger cannot be set to null");
}
} else {
level = Level.parse(levelValue);
}
logger.setLevel(level);
LOG.info("Log level updated [" + loggerName + "] changed to [" + levelValue + "]");
}
Aggregations