code: @Override
      public void sendMessage(SyslogMessage message) throws IOException {
          sendCounter.incrementAndGet();
          long nanosBefore = System.nanoTime();
  
          try {
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              Writer out = new OutputStreamWriter(baos, UTF_8);
              message.toSyslogMessage(messageFormat, out);
              out.flush();
  
              if (logger.isLoggable(Level.FINEST)) {
                  logger.finest("Send syslog message " + new String(baos.toByteArray(), UTF_8));
              }
              byte[] bytes = baos.toByteArray();
  
              DatagramPacket packet = new DatagramPacket(bytes, bytes.length, syslogServerHostnameReference.get(), syslogServerPort);
              datagramSocket.send(packet);
          } catch (IOException e) {
              sendErrorCounter.incrementAndGet();
              throw e;
          } catch (RuntimeException e) {
              sendErrorCounter.incrementAndGet();
              throw e;
          } finally {
              sendDurationInNanosCounter.addAndGet(System.nanoTime() - nanosBefore);
          }
      }
docs: Send the given {@link com.cloudbees.syslog.SyslogMessage} over UDP.
  
  @param message the message to send
  @throws IOException