From: Mateusz Warowny Date: Fri, 5 Feb 2021 14:49:34 +0000 (+0100) Subject: JAL-3810 - Add trace method to javascript implementation of Logger X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fbug%2FJAL-3810_annotation_ws_stopping_abruptly;p=jalview.git JAL-3810 - Add trace method to javascript implementation of Logger --- diff --git a/src/jalview/javascript/log4j/Logger.java b/src/jalview/javascript/log4j/Logger.java index 183328d..340e1f9 100644 --- a/src/jalview/javascript/log4j/Logger.java +++ b/src/jalview/javascript/log4j/Logger.java @@ -56,7 +56,7 @@ public class Logger if (logger == null) { registry.put(name, logger = new Logger(name)); - logger.setLevel(Level.INFO); + logger.setLevel(Level.DEBUG); } return logger; } @@ -80,6 +80,21 @@ public class Logger { return isEnabled; } + + public void trace(Object o) + { + trace(o, null); + } + + public void trace(Object o, Throwable e) + { + switch (level.level) + { + case Level.TRACE_INT: + log(o, e); + break; + } + } public void debug(Object o) { @@ -91,6 +106,7 @@ public class Logger switch (level.level) { case Priority.DEBUG_INT: + case Level.TRACE_INT: log(o, e); break; } @@ -107,6 +123,7 @@ public class Logger { case Priority.INFO_INT: case Priority.DEBUG_INT: + case Level.TRACE_INT: log(o, e); break; } @@ -125,6 +142,7 @@ public class Logger case Priority.WARN_INT: case Priority.INFO_INT: case Priority.DEBUG_INT: + case Level.TRACE_INT: log(o, e); break; } @@ -144,6 +162,7 @@ public class Logger case Priority.WARN_INT: case Priority.INFO_INT: case Priority.DEBUG_INT: + case Level.TRACE_INT: log(o, e); break; } @@ -155,27 +174,15 @@ public class Logger switch (level.level) { case Priority.ERROR_INT: - if (appender == null) - { - System.err.println(s); - return; - } - break; case Priority.WARN_INT: if (appender == null) { System.err.println(s); return; } - break; case Priority.INFO_INT: - if (appender == null) - { - System.out.println(s); - return; - } - break; case Priority.DEBUG_INT: + case Level.TRACE_INT: if (appender == null) { System.out.println(s); @@ -183,7 +190,10 @@ public class Logger } break; } - e.printStackTrace(); + if (e != null) + { + e.printStackTrace(); + } appender.append(new LoggingEvent(this, s.toString(), level)); }