X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Futil%2FMessageManager.java;fp=src%2Fjalview%2Futil%2FMessageManager.java;h=a0c2cdd1e644c647d1e0c0e6d50103d6928ee7bc;hb=d043ce47fc710d3eb2629ba926a8a7417bd67d8c;hp=5f6674ca2b27c5a37c999c944f05596521ceeadb;hpb=49db0dff1da16c3355b43a41498c1fc93ef47e91;p=jalview.git diff --git a/src/jalview/util/MessageManager.java b/src/jalview/util/MessageManager.java index 5f6674c..a0c2cdd 100644 --- a/src/jalview/util/MessageManager.java +++ b/src/jalview/util/MessageManager.java @@ -27,7 +27,7 @@ import java.util.ResourceBundle; import java.util.ResourceBundle.Control; import java.util.Set; -import org.apache.log4j.Logger; +import jalview.log.JLoggerLog4j; /** * @@ -40,8 +40,7 @@ public class MessageManager { private static ResourceBundle rb; - // BH 2018 switched to org.apache.llog4j.Logger - private static Logger log = Logger + private static JLoggerLog4j log = JLoggerLog4j .getLogger(MessageManager.class.getCanonicalName()); private static Locale loc; @@ -57,7 +56,8 @@ public class MessageManager // Locale.setDefault(loc); /* Getting messages for GV */ log.info("Getting messages for lang: " + loc); - rb = ResourceBundle.getBundle("lang.Messages", Platform.getLocaleOrNone(loc), Control.getControl(Control.FORMAT_PROPERTIES)); + Control control = Control.getControl(Control.FORMAT_PROPERTIES); + rb = ResourceBundle.getBundle("lang.Messages", Platform.getLocaleOrNone(loc), control); // if (log.isLoggable(Level.FINEST)) // { // // this might take a while, so we only do it if it will be shown @@ -93,7 +93,7 @@ public class MessageManager } catch (Exception e) { String msg = "I18N missing: " + loc + "\t" + key; - logWarning(key, msg); + logWarning(key, msg); } return value; } @@ -161,15 +161,16 @@ public class MessageManager */ public static String getStringOrReturn(String keyroot, String name) { - String smkey = keyroot + name.toLowerCase(Locale.ROOT).replaceAll(" ", ""); + String smkey = keyroot + + name.toLowerCase(Locale.ROOT).replaceAll(" ", ""); try { name = rb.getString(smkey); } catch (Exception x) { - String msg = "I18N missing key with root " + keyroot + ": " + loc + "\t" - + smkey; - logWarning(smkey, msg); + String msg = "I18N missing key with root " + keyroot + ": " + loc + + "\t" + smkey; + logWarning(smkey, msg); } return name; } @@ -180,12 +181,12 @@ public class MessageManager * @param key * @param msg */ - private static void logWarning(String key, String msg) - { - if (!reportedMissing.contains(key)) + private static void logWarning(String key, String msg) { + if (!reportedMissing.contains(key)) + { reportedMissing.add(key); - log.info(msg); - } + log.info(msg); + } } }