diff --git a/src/main/java/link/locutus/discord/Logg.java b/src/main/java/link/locutus/discord/Logg.java index f950c316..8ddfbfde 100644 --- a/src/main/java/link/locutus/discord/Logg.java +++ b/src/main/java/link/locutus/discord/Logg.java @@ -4,13 +4,13 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.async.AsyncLoggerContextSelector; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.Configurator; import org.apache.logging.log4j.core.config.LoggerConfig; import org.apache.logging.log4j.core.config.builder.api.*; import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; +import org.apache.logging.log4j.spi.LoggerContext; public class Logg { private static final Logger LOGGER; @@ -43,12 +43,13 @@ public static void setInfoLogging() { System.setProperty("log4j2.enable.threadlocals", "true"); // Enable garbage-free logging System.setProperty("log4j2.contextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"); - LoggerContext ctx = (LoggerContext) LogManager.getContext(false); - Configuration config = ctx.getConfiguration(); - LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME); - loggerConfig.setLevel(Level.INFO); - - ctx.updateLoggers(); + LoggerContext ctx = LogManager.getContext(false); + if (ctx instanceof org.apache.logging.log4j.core.LoggerContext logCtx) { + Configuration config = logCtx.getConfiguration(); + LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME); + loggerConfig.setLevel(Level.INFO); + logCtx.updateLoggers(); + } // ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME); // root.setLevel(ch.qos.logback.classic.Level.INFO); } diff --git a/src/main/java/link/locutus/discord/apiv1/enums/TreatyType.java b/src/main/java/link/locutus/discord/apiv1/enums/TreatyType.java index 7b832109..91c0236f 100644 --- a/src/main/java/link/locutus/discord/apiv1/enums/TreatyType.java +++ b/src/main/java/link/locutus/discord/apiv1/enums/TreatyType.java @@ -68,7 +68,7 @@ public boolean isOffensive() { return this == MDOAP || this == ODOAP; } - public static TreatyType[] values = values(); + public static final TreatyType[] values = values(); public static TreatyType parse(String arg) { return TreatyType.valueOf(arg.toUpperCase());