From e525842d24dd695b1a97db6c8d3e2795ed85d302 Mon Sep 17 00:00:00 2001 From: Gravit Date: Thu, 3 Jan 2019 21:31:26 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=B0=20de?= =?UTF-8?q?bug=20=D0=B4=D0=BB=D1=8F=20stacktrace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/ru/gravit/launchserver/LaunchServer.java | 1 - .../launchserver/command/basic/DebugCommand.java | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 58237d2b..88af9d57 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -374,7 +374,6 @@ public LaunchServer(Path dir) throws IOException, InvalidKeySpecException { modulesManager.autoload(dir.resolve("modules")); modulesManager.preInitModules(); initGson(); - LogHelper.setStacktraceEnabled(true); // Read LaunchServer config generateConfigIfNotExists(); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/DebugCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/DebugCommand.java index 19adc8b6..89c6a12a 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/DebugCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/basic/DebugCommand.java @@ -11,22 +11,29 @@ public DebugCommand(LaunchServer server) { @Override public String getArgsDescription() { - return "[true/false]"; + return "[true/false] (true/false)"; } @Override public String getUsageDescription() { - return "Enable or disable debug logging at runtime"; + return "Enable or disable debug and stacktrace logging at runtime"; } @Override public void invoke(String... args) { - boolean newValue; + boolean newValue, newTraceValue; if (args.length >= 1) { newValue = Boolean.parseBoolean(args[0]); + if(args.length >= 2) newTraceValue = Boolean.parseBoolean(args[1]); + else newTraceValue = newValue; LogHelper.setDebugEnabled(newValue); + LogHelper.setStacktraceEnabled(newTraceValue); } else + { newValue = LogHelper.isDebugEnabled(); + newTraceValue = LogHelper.isStacktraceEnabled(); + } LogHelper.subInfo("Debug enabled: " + newValue); + LogHelper.subInfo("Stacktrace enabled: " + newTraceValue); } }