Skip to content

Commit

Permalink
Moved initial logging after config loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Nan1t committed May 2, 2024
1 parent e9b6c88 commit 3f7c8bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/main/java/ua/nanit/limbo/server/LimboServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,13 @@ public CommandManager getCommandManager() {
}

public void start() throws Exception {
Log.info("Starting server...");

ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED);

config = new LimboConfig(Paths.get("./"));
config.load();

Log.setLevel(config.getDebugLevel());
Log.info("Starting server...");

ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED);

packetHandler = new PacketHandler(this);
dimensionRegistry = new DimensionRegistry(this);
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/ua/nanit/limbo/server/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,18 @@ public static boolean isDebug() {

static void setLevel(int level) {
debugLevel = level;
Logger logback = (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);

Logger logback = getRootLogger();

if (logback != null) {
logback.setLevel(convertLevel(level));
}
}

private static Logger getRootLogger() {
return (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
}

private static ch.qos.logback.classic.Level convertLevel(int level) {
switch (level) {
case 0:
Expand Down

0 comments on commit 3f7c8bb

Please sign in to comment.