String (LogRecord record) { Level level = record.getLevel(); String levelName = level == Level.SEVERE ? "ERROR" : level == Level.WARNING ? "WARN" : "INFO"; String className = record.getSourceClassName(); if (className != null) { className = className.substring(className.lastIndexOf('.') + 1); } String stacktrace = ""; if (record.getThrown() != null) { StringWriter writer = new StringWriter().append(System.lineSeparator()); record.getThrown().printStackTrace(new PrintWriter(writer)); stacktrace = writer.getBuffer().toString(); } return String.format("%1$td/%1$tm %1$tH:%1$tM:%1$tS %2$-5s %3$s.%4$s - %5$s%6$s%n", record.getMillis(), levelName, className, record.getSourceMethodName(), record.getMessage(), stacktrace); }