mojira.dev
MC-133130

Uncaught exception handler doesn't log the stacktrace

One of the two UncaughtExceptionHandler implementations calls LOGGER.error(e). This only causes the toString of the exception to be logged, not the stacktrace. The affected implementation is the one obfuscated as e; the other implementation (f) calls LOGGER.error(t.getName(), e) and as such is not affected as it does log a message.

An easy would be to simply change it to LOGGER.error("Caught previously unhandled exception", e) instead of having that message on a separate line. Log4j should already put it on a new line, so this should be the same behavior.

An example of this in the wild is MC-127452 (I haven't evaluated that ticket in any other way; it just does have the message logged without a stacktrace).

As far as I can tell, the relevant code was added in 18w06a.

Linked issues

Comments 1

This was fixed in 18w44a. 18w43c has the following (both cases, in e):

public void uncaughtException(Thread t, Throwable e) {
      this.logger.error("Caught previously unhandled exception :");
      this.logger.error(e);
   }

while 18w44a has the following implementation:

public void uncaughtException(Thread t, Throwable e) {
      this.logger.error("Caught previously unhandled exception :", e);
   }

I'm not sure why I added 18w50a to the list; it was fixed by that version.

pokechu22

(Unassigned)

Unconfirmed

logging, stacktrace

Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9, Minecraft 1.13-pre10, ..., Minecraft 18w30a, Minecraft 18w30b, Minecraft 18w31a, Minecraft 1.13.2, Minecraft 18w50a

Minecraft 18w44a

Retrieved