diff --git a/src/com/palmergames/bukkit/towny/TownyLogger.java b/src/com/palmergames/bukkit/towny/TownyLogger.java index 216f2caf7f..55e272a4e6 100644 --- a/src/com/palmergames/bukkit/towny/TownyLogger.java +++ b/src/com/palmergames/bukkit/towny/TownyLogger.java @@ -148,17 +148,13 @@ public void enableDebugLogger() { config.addLogger("com.palmergames.bukkit.towny.debug", townyDebugConfig); } - public void disableDebugLogger() { + public void toggleDebugLogger() { LoggerConfig townyDebugConfig = config.getLoggerConfig("Towny-Debug"); - townyDebugConfig.removeAppender("Towny-Debug"); - townyDebugConfig.removeAppender("File"); - if (!Bukkit.getVersion().contains("Paper")) { - townyDebugConfig.removeAppender("TerminalConsole"); + if (townyDebugConfig.isStarted()) { + townyDebugConfig.stop(); } else { - townyDebugConfig.removeAppender("Towny-Console-Paper"); + townyDebugConfig.start(); } - - config.removeLogger("com.palmergames.bukkit.towny.debug"); } private void enableMoneyLogger() { diff --git a/src/com/palmergames/bukkit/towny/command/TownyAdminCommand.java b/src/com/palmergames/bukkit/towny/command/TownyAdminCommand.java index 7c6380b4f8..2df61cc65a 100644 --- a/src/com/palmergames/bukkit/towny/command/TownyAdminCommand.java +++ b/src/com/palmergames/bukkit/towny/command/TownyAdminCommand.java @@ -1217,11 +1217,7 @@ public void parseToggleCommand(String[] split) throws TownyException { try { choice = !TownySettings.getDebug(); TownySettings.setDebug(choice); - if (choice) { - TownyLogger.getInstance().enableDebugLogger(); - } else { - TownyLogger.getInstance().disableDebugLogger(); - } + TownyLogger.getInstance().toggleDebugLogger(); TownyLogger.getInstance().updateLoggers(); TownyMessaging.sendMsg(getSender(), "Debug Mode " + (choice ? Colors.Green + TownySettings.getLangString("enabled") : Colors.Red + TownySettings.getLangString("disabled"))); } catch (Exception e) {