JAL-629 Fasta sequence id reading whitespace fix. Flexioble pae json keys and structu...
[jalview.git] / src / jalview / bin / Console.java
index 3e09d07..b85a4d2 100644 (file)
  */
 package jalview.bin;
 
+import java.util.Locale;
+
 import jalview.log.JLogger;
+import jalview.log.JLoggerI;
 import jalview.log.JLoggerI.LogLevel;
 import jalview.log.JLoggerLog4j;
 import jalview.util.ChannelProperties;
@@ -241,7 +244,7 @@ public class Console
     // Test message
     if (log != null)
     {
-      // Logging test message should got through the logger object
+      // Logging test message should go through the logger object
       if (log.loggerExists())
         log.debug(Console.LOGGING_TEST_MESSAGE);
       // Tell the user that debug is enabled
@@ -255,6 +258,24 @@ public class Console
     }
   }
 
+  public static void setLogLevel(String logLevelString)
+  {
+    for (LogLevel logLevel : JLoggerI.LogLevel.values())
+    {
+      if (logLevel.toString().toLowerCase(Locale.ROOT)
+              .equals(logLevelString.toLowerCase(Locale.ROOT)))
+      {
+        log.setLevel(logLevel);
+        if (!Platform.isJS())
+        {
+          Log4j.init(logLevel);
+        }
+        JLoggerLog4j.getLogger("org.apache.axis", logLevel);
+        break;
+      }
+    }
+  }
+
   public final static String LOGGING_TEST_MESSAGE = "Logging to STDERR";
 
 }