+ public static void setLogLevel(String logLevelString)
+ {
+ LogLevel l = null;
+ try
+ {
+ l = LogLevel.valueOf(logLevelString);
+ } catch (IllegalArgumentException | NullPointerException e1)
+ {
+ Console.debug("Invalid log level '" + logLevelString + "'");
+ return;
+ }
+ if (l != null)
+ {
+ log.setLevel(l);
+ if (!Platform.isJS())
+ {
+ Log4j.init(l);
+ }
+ JLoggerLog4j.getLogger("org.apache.axis", l);
+ }
+ }
+
+ public static void outPrint()
+ {
+ outPrint("");
+ }
+
+ public static void outPrintln()
+ {
+ outPrintln("");
+ }
+
+ public static void outPrint(Object message)
+ {
+ outPrintMessage(message, false, false);
+ }
+
+ public static void outPrint(Object message, boolean forceStdout)
+ {
+ outPrintMessage(message, false, forceStdout);
+ }
+
+ public static void outPrintln(Object message)
+ {
+ outPrintMessage(message, true, false);
+ }
+
+ public static PrintStream outputStream(boolean forceStdout)
+ {
+ // send message to stderr if an output file to stdout is expected
+ if (!forceStdout && Jalview.getInstance() != null
+ && Jalview.getInstance().getBootstrapArgs() != null
+ && Jalview.getInstance().getBootstrapArgs().outputToStdout())
+ {
+ return System.err;
+ }
+ else
+ {
+ return System.out;
+ }
+ }
+
+ public static void outPrintMessage(Object message, boolean newline,
+ boolean forceStdout)
+ {
+ PrintStream ps = outputStream(forceStdout);
+ if (newline)
+ {
+ ps.println(message);
+ }
+ else
+ {
+ ps.print(message);
+ }
+ }
+
+ public static void errPrint()
+ {
+ errPrint("");
+ }
+
+ public static void errPrintln()
+ {
+ errPrintln("");
+ }
+
+ public static void errPrint(Object message)
+ {
+ System.err.print(message);
+ }
+
+ public static void errPrintln(Object message)
+ {
+ System.err.println(message);
+ }
+
+ public static void debugPrintStackTrace(Throwable t)
+ {
+ if (!isDebugEnabled())
+ {
+ return;
+ }
+ // send message to stderr if output to stdout is expected
+ printStackTrace(t);
+ }
+
+ public static void printStackTrace(Throwable t)
+ {
+ // send message to stderr if output to stdout is expected
+ t.printStackTrace(System.err);
+ }
+