protected static void logForce(String type, String message) { System.err.println("logger> " + type + ": " + message); if (message.length() > MAX_MSG_LENGTH) System.err.println(" (message truncated)"); message = message.substring(0, Math.min(message.length(), MAX_MSG_LENGTH)); if(logger != null) { try { logger.log(type, message, new Date()); } catch (RuntimeException e) { //do not catch exceptions here; if this fails, we want the exception to propogate System.err.println("exception when trying to write log message! " + WrappedException.printException(e)); logger.panic(); //be conservative for now //throw e; } } }
public static void exception (String info, Exception e) { e.printStackTrace(); log("exception", (info != null ? info + ": " : "") + WrappedException.printException(e)); }