String (LogRecord record) { String level = record.getLevel() == Level.WARNING ? "WARN" : record.getLevel().toString(); String result = String.format("%1$td/%1$tm %1$tT %2$5s %3$s - %4$s%5$s", record.getMillis(), level, record.getLoggerName(), record.getMessage(), System.lineSeparator()); Throwable thrown = record.getThrown(); if (thrown != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); thrown.printStackTrace(pw); return result + sw; } return result; }