code: public String toRfc5424SyslogMessage() {
  
          StringWriter sw = new StringWriter(msg == null ? 32 : msg.size() + 32);
          try {
              toRfc5424SyslogMessage(sw);
          } catch (IOException e) {
              throw new IllegalStateException(e);
          }
          return sw.toString();
      }
docs: Generates an <a href="http://tools.ietf.org/html/rfc5424">RFC-5424</a> message.