From 6c52a1ff889b6320dd8b3767c77b0555f818352f Mon Sep 17 00:00:00 2001 From: hansonr Date: Wed, 20 Jun 2018 10:38:38 +0100 Subject: [PATCH] MessageManager logger to log4j --- src/jalview/util/MessageManager.java | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/jalview/util/MessageManager.java b/src/jalview/util/MessageManager.java index 3494181..71fc47a 100644 --- a/src/jalview/util/MessageManager.java +++ b/src/jalview/util/MessageManager.java @@ -23,8 +23,10 @@ package jalview.util; import java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; +//import java.util.logging.Level; +//import java.util.logging.Logger; + +import org.apache.log4j.Logger; /** * @@ -36,6 +38,8 @@ import java.util.logging.Logger; public class MessageManager { + // BH 2018 switched to org.apache.llog4j.Logger + private static ResourceBundle rb; private static Logger log = Logger @@ -53,19 +57,19 @@ public class MessageManager /* Getting messages for GV */ log.info("Getting messages for lang: " + loc); rb = ResourceBundle.getBundle("lang.Messages", loc); - if (log.isLoggable(Level.FINEST)) - { - // this might take a while, so we only do it if it will be shown - log.finest("Language keys: " + rb.keySet()); - } + // if (log.isLoggable(Level.FINEST)) + // { + // // this might take a while, so we only do it if it will be shown + // log.info("Language keys: " + rb.keySet()); // was FINEST + // } } catch (Exception q) { - log.warning("Exception when initting Locale for i18n messages\n" + log.warn("Exception when initting Locale for i18n messages\n" + q.getMessage()); q.printStackTrace(); } catch (Error v) { - log.warning("Error when initting Locale for i18n messages\n" + log.warn("Error when initting Locale for i18n messages\n" + v.getMessage()); v.printStackTrace(); } @@ -80,7 +84,7 @@ public class MessageManager value = rb.getString(key); } catch (Exception e) { - log.warning("I18N missing: " + loc + "\t" + key); + log.warn("I18N missing: " + loc + "\t" + key); } return value; } @@ -119,8 +123,8 @@ public class MessageManager name = rb.getString(smkey); } catch (Exception x) { - log.finest("I18N missing key with root " + keyroot + ": " + loc + "\t" - + smkey); + log.info("I18N missing key with root " + keyroot + ": " + loc + "\t" + + smkey); // was FINEST } return name; } -- 1.7.10.2