public void toRfc5424SyslogMessage(Writer out) throws IOException {

        int pri = facility.numericalCode() * 8 + severity.numericalCode();

        out.write('<');
        out.write(String.valueOf(pri));
        out.write('>');
        out.write('1'); // version
        out.write(SP);
        out.write(rfc3339DateFormat.format(timestamp == null ? new Date() : new Date(timestamp))); // message time
        out.write(SP);
        out.write(hostname == null ? localhostNameReference.get() : hostname); // emitting server hostname
        out.write(SP);
        writeNillableValue(appName, out); // appname
        out.write(SP);
        writeNillableValue(procId, out); // PID
        out.write(SP);
        writeNillableValue(msgId, out);// Message ID
        out.write(SP);
        writeStructuredDataOrNillableValue(sdElements, out);
        if (msg != null) {
            out.write(SP);
            msg.writeTo(out);
        }
    }
public void toRfc5424SyslogMessage ( Writer out ) throws IOException { int pri = facility . numericalCode ( ) * 8 + severity . numericalCode ( ) ; out . write ( '<' ) ; out . write ( String . valueOf ( pri ) ) ; out . write ( '>' ) ; out . write ( '1' ) ; out . write ( SP ) ; out . write ( rfc3339DateFormat . format ( timestamp == null ? new Date ( ) : new Date ( timestamp ) ) ) ; out . write ( SP ) ; out . write ( hostname == null ? localhostNameReference . get ( ) : hostname ) ; out . write ( SP ) ; writeNillableValue ( appName , out ) ; out . write ( SP ) ; writeNillableValue ( procId , out ) ; out . write ( SP ) ; writeNillableValue ( msgId , out ) ; out . write ( SP ) ; writeStructuredDataOrNillableValue ( sdElements , out ) ; if ( msg != null ) { out . write ( SP ) ; msg . writeTo ( out ) ; } }
Generates an <a href="http://tools.ietf.org/html/rfc5424">RFC-5424</a> message.

The priority is calculated by facility * 8 + severity, see
<a href="https://tools.ietf.org/html/rfc5424#section-6.2.1">RFC-5424, Section 6.2.1</a>