From 7c098462fedf3dd37903823d557db9263814d055 Mon Sep 17 00:00:00 2001 From: malte0811 Date: Sun, 1 Apr 2018 09:25:38 +0200 Subject: [PATCH] Fix FMLCommonHandler#exitJava printing useless/wrong calling info (#4742) --- .../fml/common/FMLCommonHandler.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java index 99f47254a..062a80309 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java @@ -663,18 +663,17 @@ public class FMLCommonHandler */ public void exitJava(int exitCode, boolean hardExit) { - FMLLog.log.info("Java has been asked to exit (code {}) by {}.", exitCode, Thread.currentThread().getStackTrace()[1]); + FMLLog.log.warn("Java has been asked to exit (code {})", exitCode); if (hardExit) { - FMLLog.log.info("This is an abortive exit and could cause world corruption or other things"); + FMLLog.log.warn("This is an abortive exit and could cause world corruption or other things"); } - if (Boolean.parseBoolean(System.getProperty("fml.debugExit", "false"))) + StackTraceElement[] stack = Thread.currentThread().getStackTrace(); + FMLLog.log.warn("Exit trace:"); + //The first 2 elements are Thread#getStackTrace and FMLCommonHandler#exitJava and aren't relevant + for (int i = 2; i < stack.length; i++) { - FMLLog.log.info("Exit trace", new Throwable()); - } - else - { - FMLLog.log.info("If this was an unexpected exit, use -Dfml.debugExit=true as a JVM argument to find out where it was called"); + FMLLog.log.warn("\t{}", stack[i]); } if (hardExit) {