@Override
    public String format(LogRecord lr) {
        char c;
        switch(lr.getLevel().intValue()){
            case 1000:
                c = 'F'; // Indicates a fatal exception generally paired with
                break; // actions to shut down the errored process.
            case 900:
                c = 'E'; // Indicates an unexpected error.
                break;
            case 800:
                c = 'W'; // Indicates a warning message likely worth of attention.
                break;
            case 700:
                c = 'I'; // Indicates a message of general interest.
                break;
            default:
                c = 'D'; // Indicates the message is for debugging purposes only.
                break;
        }       
        
        String message = formatMessage(lr);
        int messageLength = BASE_MESSAGE_LENGTH
                + 2 // Colon and space
                + message.length();
        String className = lr.getSourceClassName();
        String methodName = null;
        if (className != null) {
            messageLength += className.length();
            methodName = lr.getSourceMethodName();
            if (methodName != null) {
                messageLength += 1;  // Period between class and method.
                messageLength += methodName.length();
            }
        }
        
        StringBuilder sb = new StringBuilder(messageLength)
                .append(c)
                .append(df.format(new Date(lr.getMillis())))
                .append(" T")
                .append(lr.getThreadID());

        if(className != null){
            sb.append(' ').append(className);
            if(methodName != null){
                sb.append('.').append(methodName);
            }
        }
        sb.append(": ").append(message);

        Throwable tr = lr.getThrown();
        if (tr != null) {
            sb.append(System.getProperty("line.separator"));
            StringWriter sw = new StringWriter();
            try (PrintWriter pw = new PrintWriter(sw)) {
                tr.printStackTrace(pw);
                sb.append(sw.toString());
            }
        }

        return sb.append(System.getProperty("line.separator")).toString();
    }