From f5f6af7c725d698fd1f53aca15b9a5e5743ae434 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 16 Dec 2022 16:45:18 +0000 Subject: [PATCH] JAL-4109 examine -Djalview.loglevel on startup to decide what the default log level should be --- src/jalview/bin/Console.java | 12 ++++++++++-- test/jalview/io/testProps.jvprops | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/jalview/bin/Console.java b/src/jalview/bin/Console.java index 3e09d07..53ff753 100644 --- a/src/jalview/bin/Console.java +++ b/src/jalview/bin/Console.java @@ -30,7 +30,7 @@ import jalview.util.Platform; public class Console { - public static JLoggerLog4j log; + public static JLoggerLog4j log=null; public static void debug(String message, Throwable t) { @@ -220,7 +220,14 @@ public class Console } try { - JLogger.LogLevel cachedLevel = getCachedLogLevel(); + JLogger.LogLevel cachedLevel=null; + if (System.getProperty("jalview.loglevel")!=null) + { + cachedLevel = JLogger.LogLevel.valueOf(System.getProperty("jalview.loglevel")); + } + if (cachedLevel==null) { + cachedLevel = getCachedLogLevel(); + } if (!Platform.isJS()) { Log4j.init(cachedLevel); @@ -232,6 +239,7 @@ public class Console // The main application logger log = JLoggerLog4j.getLogger(Cache.JALVIEW_LOGGER_NAME, cachedLevel); + log.info("Logging initialised at level: "+cachedLevel); } catch (NoClassDefFoundError e) { System.err.println("Could not initialise the logger framework"); diff --git a/test/jalview/io/testProps.jvprops b/test/jalview/io/testProps.jvprops index 94bc5d9..bca2958 100644 --- a/test/jalview/io/testProps.jvprops +++ b/test/jalview/io/testProps.jvprops @@ -1,6 +1,7 @@ #---JalviewX Properties File--- #Fri Apr 25 09:54:25 BST 2014 -# +# Uncomment to enable debug logging +# logs.Jalview.level=DEBUG BACKUPFILES_ENABLED=true BACKUPFILES_PRESET=0 BACKUPFILES_SAVED=_BACKUPFILESTESTTMP%n\t6\tfalse\tfalse\t2\tfalse -- 1.7.10.2