From 0310bd49dfec303201d3e7610698a889082beb65 Mon Sep 17 00:00:00 2001
From: Per Leino <per.leino@cryptzone.com>
Date: Tue, 14 Mar 2017 15:24:30 +0100
Subject: [PATCH 01/44] Make it configurable to end messages with CR LF for
 TCPSender

---
 .../syslog/sender/TcpSyslogMessageSender.java          | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
index 65a0083..c9a94ca 100644
--- a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
@@ -76,6 +76,9 @@ public class TcpSyslogMessageSender extends AbstractSyslogMessageSender {
      */
     protected final AtomicInteger trySendErrorCounter = new AtomicInteger();
 
+    // use the CR LF non transparent framing as described in "3.4.2.  Non-Transparent-Framing"
+    private String postfix = "\r\n";
+
     @Override
     public synchronized void sendMessage(@Nonnull SyslogMessage message) throws IOException {
         sendCounter.incrementAndGet();
@@ -90,8 +93,7 @@ public synchronized void sendMessage(@Nonnull SyslogMessage message) throws IOEx
                     }
                     ensureSyslogServerConnection();
                     message.toSyslogMessage(messageFormat, writer);
-                    // use the CR LF non transparent framing as described in "3.4.2.  Non-Transparent-Framing"
-                    writer.write("\r\n");
+                    writer.write(postfix);
                     writer.flush();
                     return;
                 } catch (IOException e) {
@@ -240,6 +242,10 @@ public void setMaxRetryCount(int maxRetryCount) {
         this.maxRetryCount = maxRetryCount;
     }
 
+    public void setPostfix(String postfix) {
+        this.postfix = postfix;
+    }
+
     @Override
     public String toString() {
         return getClass().getName() + "{" +

From 3f1bb400d2b6d43b15abd82ab6f1dbef8357eea7 Mon Sep 17 00:00:00 2001
From: dhsmith1001 <donald.h.smith@gmail.com>
Date: Tue, 6 Jun 2017 15:38:52 -0400
Subject: [PATCH 02/44] Modified Facility to use digits 0 - 23 instead of
 multiplied by 8, to conform with syslog spec

---
 .../java/com/cloudbees/syslog/Facility.java   | 46 +++++++++----------
 .../com/cloudbees/syslog/SyslogMessage.java   | 11 +++--
 .../cloudbees/syslog/SyslogMessageTest.java   |  6 +--
 3 files changed, 33 insertions(+), 30 deletions(-)
 mode change 100644 => 100755 src/main/java/com/cloudbees/syslog/Facility.java
 mode change 100644 => 100755 src/main/java/com/cloudbees/syslog/SyslogMessage.java
 mode change 100644 => 100755 src/test/java/com/cloudbees/syslog/SyslogMessageTest.java

diff --git a/src/main/java/com/cloudbees/syslog/Facility.java b/src/main/java/com/cloudbees/syslog/Facility.java
old mode 100644
new mode 100755
index c485d12..a2a3a34
--- a/src/main/java/com/cloudbees/syslog/Facility.java
+++ b/src/main/java/com/cloudbees/syslog/Facility.java
@@ -37,95 +37,95 @@ public enum Facility implements Comparable<Facility> {
     /**
      * user-level messages, numerical code 1.
      */
-    USER(1 << 3, "USER"),
+    USER(1, "USER"),
     /**
      * mail system, numerical code 2.
      */
-    MAIL(2 << 3, "MAIL"),
+    MAIL(2, "MAIL"),
     /**
      * system daemons, numerical code 3.
      */
-    DAEMON(3 << 3, "DAEMON"),
+    DAEMON(3, "DAEMON"),
     /**
      * security/authorization messages, numerical code 4.
      */
-    AUTH(4 << 3, "AUTH"),
+    AUTH(4, "AUTH"),
     /**
      * messages generated internally by syslogd, numerical code 5.
      */
-    SYSLOG(5 << 3, "SYSLOG"),
+    SYSLOG(5, "SYSLOG"),
     /**
      * line printer subsystem, numerical code 6.
      */
-    LPR(6 << 3, "LPR"),
+    LPR(6, "LPR"),
     /**
      * network news subsystem, numerical code 7.
      */
-    NEWS(7 << 3, "NEWS"),
+    NEWS(7, "NEWS"),
     /**
      * UUCP subsystem, numerical code 8
      */
-    UUCP(8 << 3, "UUCP"),
+    UUCP(8, "UUCP"),
     /**
      * clock daemon, numerical code 9.
      */
-    CRON(9 << 3, "CRON"),
+    CRON(9, "CRON"),
     /**
      * security/authorization  messages, numerical code 10.
      */
-    AUTHPRIV(10 << 3, "AUTHPRIV"),
+    AUTHPRIV(10, "AUTHPRIV"),
     /**
      * ftp daemon, numerical code 11.
      */
-    FTP(11 << 3, "FTP"),
+    FTP(11, "FTP"),
     /**
      * NTP subsystem, numerical code 12.
      */
-    NTP(12 << 3, "NTP"),
+    NTP(12, "NTP"),
     /**
      * log audit, numerical code 13.
      */
-    AUDIT(13 << 3, "AUDIT"),
+    AUDIT(13, "AUDIT"),
     /**
      * log alert, numerical code 14.
      */
-    ALERT(14 << 3, "ALERT"),
+    ALERT(14, "ALERT"),
     /**
      * clock daemon, numerical code 15.
      */
-    CLOCK(15 << 3, "CLOCK"),
+    CLOCK(15, "CLOCK"),
     /**
      * reserved for local use, numerical code 16.
      */
-    LOCAL0(16 << 3, "LOCAL0"),
+    LOCAL0(16, "LOCAL0"),
     /**
      * reserved for local use, numerical code 17.
      */
-    LOCAL1(17 << 3, "LOCAL1"),
+    LOCAL1(17, "LOCAL1"),
     /**
      * reserved for local use, numerical code 18.
      */
-    LOCAL2(18 << 3, "LOCAL2"),
+    LOCAL2(18, "LOCAL2"),
     /**
      * reserved for local use, numerical code 19.
      */
-    LOCAL3(19 << 3, "LOCAL3"),
+    LOCAL3(19, "LOCAL3"),
     /**
      * reserved for local use, numerical code 20.
      */
-    LOCAL4(20 << 3, "LOCAL4"),
+    LOCAL4(20, "LOCAL4"),
     /**
      * reserved for local use, numerical code 21.
      */
-    LOCAL5(21 << 3, "LOCAL5"),
+    LOCAL5(21, "LOCAL5"),
     /**
      * reserved for local use, numerical code 22.
      */
-    LOCAL6(22 << 3, "LOCAL6"),
+    LOCAL6(22, "LOCAL6"),
     /**
      * reserved for local use, numerical code 23.
      */
-    LOCAL7(23 << 3, "LOCAL7");
+    LOCAL7(23, "LOCAL7");
 
     // mapping
     private final static Map<String, Facility> facilityFromLabel = new HashMap<String, Facility>();
diff --git a/src/main/java/com/cloudbees/syslog/SyslogMessage.java b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
old mode 100644
new mode 100755
index 87e065c..06f7cf1
--- a/src/main/java/com/cloudbees/syslog/SyslogMessage.java
+++ b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
@@ -15,9 +15,6 @@
  */
 package com.cloudbees.syslog;
 
-import com.cloudbees.syslog.util.CachingReference;
-import com.cloudbees.syslog.util.ConcurrentDateFormat;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import java.io.CharArrayWriter;
@@ -31,6 +28,9 @@
 import java.util.TimeZone;
 import java.util.concurrent.TimeUnit;
 
+import com.cloudbees.syslog.util.CachingReference;
+import com.cloudbees.syslog.util.ConcurrentDateFormat;
+
 /**
  * Syslog message as defined in <a href="https://tools.ietf.org/html/rfc5424">RFC 5424 - The Syslog Protocol</a>.
  *
@@ -267,10 +267,13 @@ public String toRfc5424SyslogMessage() {
 
     /**
      * 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>
      */
     public void toRfc5424SyslogMessage(Writer out) throws IOException {
 
-        int pri = facility.numericalCode() + severity.numericalCode();
+        int pri = facility.numericalCode() * 8 + severity.numericalCode();
 
         out.write('<');
         out.write(String.valueOf(pri));
diff --git a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
old mode 100644
new mode 100755
index fb53cc6..e2b42a8
--- a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
+++ b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
@@ -15,11 +15,11 @@
  */
 package com.cloudbees.syslog;
 
-import org.junit.Test;
-
 import java.util.Calendar;
 import java.util.TimeZone;
 
+import org.junit.Test;
+
 import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertThat;
 
@@ -78,7 +78,7 @@ public void testRfc3164Format() throws Exception {
                 .withMsg("a syslog message");
 
         String actual = message.toRfc3164SyslogMessage();
-        String expected = "<14>Dec 05 10:30:05 myserver.example.com my_app: a syslog message";
+        String expected = "<7>Dec 05 10:30:05 myserver.example.com my_app: a syslog message";
 
         assertThat(actual, is(expected));
 

From 9cbeb4fad2212ba6e1617a54b816642ea1275765 Mon Sep 17 00:00:00 2001
From: Brett Bergquist <bbergquist@canoga.com>
Date: Thu, 17 Aug 2017 12:45:44 -0400
Subject: [PATCH 03/44] Added initial support for Structured Data. Things left
 to do:    - verify proper encoding to match the RFC    - verify reserved
 SD-ID's

---
 .../java/com/cloudbees/syslog/SDElement.java  | 136 ++++++++++++++++++
 .../java/com/cloudbees/syslog/SDParam.java    | 131 +++++++++++++++++
 .../com/cloudbees/syslog/SyslogMessage.java   |  74 +++++++++-
 .../cloudbees/syslog/SyslogMessageTest.java   |  34 +++++
 4 files changed, 374 insertions(+), 1 deletion(-)
 create mode 100644 src/main/java/com/cloudbees/syslog/SDElement.java
 create mode 100644 src/main/java/com/cloudbees/syslog/SDParam.java

diff --git a/src/main/java/com/cloudbees/syslog/SDElement.java b/src/main/java/com/cloudbees/syslog/SDElement.java
new file mode 100644
index 0000000..0a66ed4
--- /dev/null
+++ b/src/main/java/com/cloudbees/syslog/SDElement.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2010-2014, CloudBees Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.cloudbees.syslog;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * A SD-ELEMENT
+ * 
+ * @author <a href="mailto:brett@thebergquistfamily.com">Brett Bergquist</a>
+ */
+public class SDElement implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    public SDElement(String sdID) {
+        validateSDID(sdID);
+        this.sdID = sdID;
+    }
+    
+    public SDElement(String sdID, SDParam... sdParams) {
+        validateSDID(sdID);
+        this.sdID = sdID;
+        this.sdParams.addAll(Arrays.asList(sdParams));
+    }
+
+    private String sdID;
+
+    /**
+     * Get the value of sdID
+     *
+     * @return the value of sdID
+     */
+    public String getSdID() {
+        return sdID;
+    }
+
+    private List<SDParam> sdParams = new ArrayList<SDParam>();
+
+    /**
+     * Get the value of sdParams
+     *
+     * @return the value of sdParams
+     */
+    public List<SDParam> getSdParams() {
+        return sdParams;
+    }
+
+    /**
+     * Set the value of sdParams
+     *
+     * @param sdParams new value of sdParams
+     */
+    public void setSdParams(List<SDParam> sdParams) {
+        if (null == sdParams) {
+            throw new IllegalArgumentException("sdParams list cannot be null");
+        }
+        this.sdParams.addAll(sdParams);
+    }
+
+    /**
+     * Adds a SDParam
+     * @param paramName the PARAM-NAME
+     * @param paramValue the PARAM-VALUE
+     * @return
+     */
+    public SDElement addSDParam(String paramName, String paramValue) {
+        return addSDParam(new SDParam(paramName, paramValue));
+    }
+    
+    public SDElement addSDParam(SDParam sdParam) {
+        this.sdParams.add(sdParam);
+        return this;
+    }
+    
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 97 * hash + Objects.hashCode(this.sdID);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final SDElement other = (SDElement) obj;
+        return Objects.equals(this.sdID, other.sdID);
+    }
+    
+    private void validateSDID(String sdName) {
+        if (null == sdName) {
+            throw new IllegalArgumentException("SD-ID cannot be null");
+        }
+        if (sdName.length() > 32) {
+            throw new IllegalArgumentException("SD-ID must be less than 32 characters: " + sdName);
+        }
+        if (sdName.contains("=")) {
+            throw new IllegalArgumentException("SD-ID cannot contain '='");
+        }
+        if (sdName.contains(" ")) {
+            throw new IllegalArgumentException("SD-ID cannot contain ' '");
+        }
+        if (sdName.contains("]")) {
+            throw new IllegalArgumentException("SD-ID cannot contain ']'");
+        }
+        if (sdName.contains("\"")) {
+            throw new IllegalArgumentException("SD-ID cannot contain '\"'");
+        }
+    }
+
+}
diff --git a/src/main/java/com/cloudbees/syslog/SDParam.java b/src/main/java/com/cloudbees/syslog/SDParam.java
new file mode 100644
index 0000000..de0527f
--- /dev/null
+++ b/src/main/java/com/cloudbees/syslog/SDParam.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2010-2014, CloudBees Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.cloudbees.syslog;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ *
+ * @author <a href="mailto:brett@thebergquistfamily.com">Brett Bergquist</a>
+ */
+public class SDParam implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    public SDParam(String paramName, String paramValue) {
+        validateParamName(paramName);
+        this.paramName = paramName;
+        this.paramValue = paramValue;
+    }
+    
+    private String paramName;
+
+    /**
+     * Get the value of paramName
+     *
+     * @return the value of paramName
+     */
+    public String getParamName() {
+        return paramName;
+    }
+
+    /**
+     * Set the value of paramName
+     *
+     * @param paramName new value of paramName
+     */
+    public void setParamName(String paramName) {
+        validateParamName(paramName);
+        this.paramName = paramName;
+    }
+
+    private String paramValue;
+
+    /**
+     * Get the value of paramValue
+     *
+     * @return the value of paramValue
+     */
+    public String getParamValue() {
+        return paramValue;
+    }
+
+    /**
+     * Set the value of paramValue
+     *
+     * @param paramValue new value of paramValue
+     */
+    public void setParamValue(String paramValue) {
+        this.paramValue = paramValue;
+    }
+
+    private void validateParamName(String sdName) {
+        if (null == sdName) {
+            throw new IllegalArgumentException("PARAM-NAME cannot be null");
+        }
+        if (sdName.length() > 32) {
+            throw new IllegalArgumentException("PARAM-NAME must be less than 32 characters: " + sdName); 
+        }
+        if (sdName.contains("=")) {
+            throw new IllegalArgumentException("PARAM-NAME cannot contain '='");
+        }
+        if (sdName.contains(" ")) {
+            throw new IllegalArgumentException("PARAM-NAME cannot contain ' '");
+        }
+        if (sdName.contains("]")) {
+            throw new IllegalArgumentException("PARAM-NAME cannot contain ']'");
+        }
+        if (sdName.contains("\"")) {
+            throw new IllegalArgumentException("PARAM-NAME cannot contain '\"'");
+        }
+    }
+    
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 59 * hash + Objects.hashCode(this.paramName);
+        hash = 59 * hash + Objects.hashCode(this.paramValue);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final SDParam other = (SDParam) obj;
+        if (!Objects.equals(this.paramName, other.paramName)) {
+            return false;
+        }
+        if (!Objects.equals(this.paramValue, other.paramValue)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "SDParam{" + "paramName=" + paramName + ", paramValue=" + paramValue + '}';
+    }
+
+}
diff --git a/src/main/java/com/cloudbees/syslog/SyslogMessage.java b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
index 87e065c..fb499e4 100644
--- a/src/main/java/com/cloudbees/syslog/SyslogMessage.java
+++ b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
@@ -27,7 +27,9 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.Locale;
+import java.util.Set;
 import java.util.TimeZone;
 import java.util.concurrent.TimeUnit;
 
@@ -91,6 +93,7 @@ protected String newObject() {
     private String appName;
     private String procId;
     private String msgId;
+    private Set<SDElement> sdElements;
     /**
      * Use a {@link java.io.CharArrayWriter} instead of a {@link String}  or a {@code char[]} because middlewares like
      * Apache Tomcat use {@code CharArrayWriter} and it's convenient for pooling objects.
@@ -213,6 +216,26 @@ public SyslogMessage withMsg(final String msg) {
             }
         });
     }
+    
+    public Set<SDElement> getSDElements() {
+        Set<SDElement> ssde = sdElements;
+        if (ssde == null) {
+            ssde = new HashSet<SDElement>(0);
+        }
+        return ssde;
+    }
+    
+    public void setSDElements(Set<SDElement> ssde) {
+        this.sdElements = ssde;
+    }
+    
+    public SyslogMessage withSDElement(SDElement sde) {
+        if (sdElements == null) {
+            sdElements = new HashSet<SDElement>();
+        }
+        sdElements.add(sde);
+        return this;
+    }
 
     /**
      * Generates a Syslog message complying to the <a href="http://tools.ietf.org/html/rfc5424">RFC-5424</a> format
@@ -287,7 +310,7 @@ public void toRfc5424SyslogMessage(Writer out) throws IOException {
         out.write(SP);
         writeNillableValue(msgId, out);// Message ID
         out.write(SP);
-        out.write(NILVALUE); // structured data
+        writeStructuredDataOrNillableValue(sdElements, out);
         if (msg != null) {
             out.write(SP);
             msg.writeTo(out);
@@ -339,4 +362,53 @@ protected void writeNillableValue(@Nullable String value, @Nonnull Writer out) t
             out.write(value);
         }
     }
+    
+    protected void writeStructuredDataOrNillableValue(@Nullable Set<SDElement> ssde, @Nonnull Writer out) throws IOException {
+        if (ssde == null || ssde.isEmpty()) {
+            out.write(NILVALUE);
+        } else {
+            for (SDElement sde : ssde) {
+                writeSDElement(sde, out);
+            }
+        }
+    }
+    
+    protected void writeSDElement(@Nonnull SDElement sde, @Nonnull Writer out) throws IOException {
+        out.write("[");
+        out.write(sde.getSdID());
+        for (SDParam sdp : sde.getSdParams()) {
+            writeSDParam(sdp, out);
+        }
+        out.write("]");
+    }
+    
+    protected void writeSDParam(@Nonnull SDParam sdp, @Nonnull Writer out) throws IOException {
+        out.write(SP);
+        out.write(sdp.getParamName());
+        out.write('=');
+        out.write('"');
+        out.write(getEscapedParamValue(sdp.getParamValue()));
+        out.write('"');
+    }
+    
+    protected String getEscapedParamValue(String paramValue) {
+        StringBuilder sb = new StringBuilder(paramValue.length());
+        
+        for (int i = 0; i < paramValue.length(); i++) {
+            char c = paramValue.charAt(i);
+            switch (c) {
+                // Falls through
+                case '"':
+                case '\\':
+                case ']':
+                    sb.append('\\');
+                    break;
+                default:
+                    break;
+            }
+            sb.append(c);
+        }
+        
+        return sb.toString();
+    }
 }
diff --git a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
index fb53cc6..7326484 100644
--- a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
+++ b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
@@ -56,6 +56,40 @@ public void testRfc5424Format() throws Exception {
 
     }
 
+    @Test
+    public void testRfc5424FormatWithStructuredData() throws Exception {
+        Calendar cal = Calendar.getInstance();
+        cal.setTimeZone(TimeZone.getTimeZone("GMT"));
+        cal.set(2013, Calendar.DECEMBER, 5, 10, 30, 5);
+        cal.set(Calendar.MILLISECOND, 0);
+
+        System.out.println(SyslogMessage.rfc3339DateFormat.format(cal.getTime()));
+        System.out.println(cal.getTimeInMillis());
+
+
+        SyslogMessage message = new SyslogMessage()
+                .withTimestamp(cal.getTimeInMillis())
+                .withAppName("my_app")
+                .withHostname("myserver.example.com")
+                .withFacility(Facility.USER)
+                .withSeverity(Severity.INFORMATIONAL)
+                .withTimestamp(cal.getTimeInMillis())
+                .withMsg("a syslog message")
+                .withSDElement(new SDElement("exampleSDID@32473", new SDParam("iut", "3"), new SDParam("eventSource", "Application"), new SDParam("eventID", "1011")));
+
+        String actual = message.toRfc5424SyslogMessage();
+        String expected = "<14>1 2013-12-05T10:30:05.000Z myserver.example.com my_app - - [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"] a syslog message";
+
+        assertThat(actual, is(expected));
+        
+        message.withSDElement(new SDElement("examplePriority@32473", new SDParam("class", "high")));
+        actual = message.toRfc5424SyslogMessage();
+        expected = "<14>1 2013-12-05T10:30:05.000Z myserver.example.com my_app - - [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"] a syslog message";
+        
+        assertThat(actual, is(expected));
+        
+    }
+
     @Test
     public void testRfc3164Format() throws Exception {
 

From 31627c2478ba2536af0adac87018ea1dd03d9eb5 Mon Sep 17 00:00:00 2001
From: Brett Bergquist <bbergquist@canoga.com>
Date: Thu, 17 Aug 2017 12:58:15 -0400
Subject: [PATCH 04/44] Added check for documented reserved SD-ID's

---
 .../java/com/cloudbees/syslog/SDElement.java  | 22 +++++++++++++++++++
 .../cloudbees/syslog/SyslogMessageTest.java   |  1 -
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/cloudbees/syslog/SDElement.java b/src/main/java/com/cloudbees/syslog/SDElement.java
index 0a66ed4..f58f0e2 100644
--- a/src/main/java/com/cloudbees/syslog/SDElement.java
+++ b/src/main/java/com/cloudbees/syslog/SDElement.java
@@ -30,6 +30,16 @@ public class SDElement implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    /**
+     * Reserved SD-IDs as documented in <a href="https://www.rfc-editor.org/rfc/rfc5424.txt">RFC-5424</a>
+     */
+    public static final String[] RESERVED_SDID = new String[]{
+        "timeQuality",
+        "tzKnown",
+        "isSynced",
+        "syncAccuracy"
+    };
+
     public SDElement(String sdID) {
         validateSDID(sdID);
         this.sdID = sdID;
@@ -131,6 +141,18 @@ private void validateSDID(String sdName) {
         if (sdName.contains("\"")) {
             throw new IllegalArgumentException("SD-ID cannot contain '\"'");
         }
+        if (! sdName.contains("@")) {
+            boolean found = false;
+            for (String rn : RESERVED_SDID) {
+                if (rn.equals(sdName)) {
+                    found = true;
+                    break;
+                }
+            }
+            if (! found) {
+                throw new IllegalArgumentException("SD-ID is not known registered SDID: " + sdName);
+            }
+        }
     }
 
 }
diff --git a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
index 7326484..b940323 100644
--- a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
+++ b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
@@ -87,7 +87,6 @@ public void testRfc5424FormatWithStructuredData() throws Exception {
         expected = "<14>1 2013-12-05T10:30:05.000Z myserver.example.com my_app - - [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"] a syslog message";
         
         assertThat(actual, is(expected));
-        
     }
 
     @Test

From 5a1189df298a7e1af2050d1463120d781322000e Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 6 Sep 2017 12:35:57 +0200
Subject: [PATCH 05/44] better test

---
 .../syslog/sender/UdpSyslogMessageSenderLoadTest.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/test/java/com/cloudbees/syslog/sender/UdpSyslogMessageSenderLoadTest.java b/src/test/java/com/cloudbees/syslog/sender/UdpSyslogMessageSenderLoadTest.java
index cf7f663..0898504 100644
--- a/src/test/java/com/cloudbees/syslog/sender/UdpSyslogMessageSenderLoadTest.java
+++ b/src/test/java/com/cloudbees/syslog/sender/UdpSyslogMessageSenderLoadTest.java
@@ -40,15 +40,15 @@ public static void main(String[] args) throws Exception {
         messageSender.setDefaultAppName("myapp");
         messageSender.setDefaultFacility(Facility.USER);
         messageSender.setDefaultSeverity(Severity.INFORMATIONAL);
-        // messageSender.setSyslogServerHostname("cloudbees1.papertrailapp.com");
-        messageSender.setSyslogServerHostname("127.0.0.1");
-        messageSender.setSyslogServerPort(18977);
+        messageSender.setSyslogServerHostname("logs2.papertrailapp.com");
+        // messageSender.setSyslogServerHostname("127.0.0.1");
+        messageSender.setSyslogServerPort(46022);
 
         final AtomicInteger count = new AtomicInteger();
 
 
         for (int i = 0; i < THREADS_COUNT; i++) {
-            final String prefix = "thread-" + i + "msg-";
+            final String prefix = "thread-" + i + "-udp-msg-";
 
             Runnable command = new Runnable() {
                 @Override

From 8e266a4295b87a7f4640634f6eb64333075644f7 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 6 Sep 2017 12:36:27 +0200
Subject: [PATCH 06/44] [maven-release-plugin] prepare release
 syslog-java-client-1.1.0

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8a2ca05..035c455 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.0.9-SNAPSHOT</version>
+    <version>1.1.0</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>HEAD</tag>
+      <tag>syslog-java-client-1.1.0</tag>
   </scm>
     <dependencies>
         <dependency>

From f42ddd817327e4b4cb19a586177c72a770a233ad Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 6 Sep 2017 12:36:33 +0200
Subject: [PATCH 07/44] [maven-release-plugin] prepare for next development
 iteration

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 035c455..e99f084 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.0</version>
+    <version>1.1.1-SNAPSHOT</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>syslog-java-client-1.1.0</tag>
+      <tag>HEAD</tag>
   </scm>
     <dependencies>
         <dependency>

From 1c599723eeb8c900c1bc83d8de256ad61095cbd6 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 6 Sep 2017 14:14:12 +0200
Subject: [PATCH 08/44] Update README.md

---
 README.md | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/README.md b/README.md
index 1369152..6074965 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,21 @@ Client library written in Java to send messages to a Syslog server.
    * `TcpSyslogMessageSender`: [RFC 6587 - Transmission of Syslog Messages over TCP](http://tools.ietf.org/html/rfc5426) (including SSL support)
  * `com.cloudbees.syslog.integration.jul.SyslogHandler`: java.util.logging handler to output log messages to a Syslog server.
 
+## Release Notes
 
+See https://github.com/CloudBees-community/syslog-java-client/releases/tag/syslog-java-client-1.1.0
+
+## Using the Syslog Java Client with Maven 
+
+Add the following dependency in your pom.xml:
+
+```xml
+<dependency>
+    <groupId>com.cloudbees</groupId>
+    <artifactId>syslog-java-client</artifactId>
+    <version>1.1.0</version>
+</dependency>
+```
 
 ## Sample UDP sender using RFC 3164
 

From 8f55fc02ae4f585ab08b064159378981c629887f Mon Sep 17 00:00:00 2001
From: Brett Bergquist <bbergquist@canoga.com>
Date: Fri, 15 Sep 2017 14:14:11 -0400
Subject: [PATCH 09/44] The list of reserved SD-ID's was incorrect.  Changed to
 the correct list.

---
 src/main/java/com/cloudbees/syslog/SDElement.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/cloudbees/syslog/SDElement.java b/src/main/java/com/cloudbees/syslog/SDElement.java
index f58f0e2..a9894ee 100644
--- a/src/main/java/com/cloudbees/syslog/SDElement.java
+++ b/src/main/java/com/cloudbees/syslog/SDElement.java
@@ -35,9 +35,8 @@ public class SDElement implements Serializable {
      */
     public static final String[] RESERVED_SDID = new String[]{
         "timeQuality",
-        "tzKnown",
-        "isSynced",
-        "syncAccuracy"
+        "origin",
+        "meta"
     };
 
     public SDElement(String sdID) {

From 0011e5a082b8c39e2ccd2e029d15abb4bc0157c5 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Fri, 6 Oct 2017 10:42:40 +0200
Subject: [PATCH 10/44] better readme file

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 6074965..c2b6b86 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Client library written in Java to send messages to a Syslog server.
 
 ## Release Notes
 
-See https://github.com/CloudBees-community/syslog-java-client/releases/tag/syslog-java-client-1.1.0
+See https://github.com/CloudBees-community/syslog-java-client/releases/
 
 ## Using the Syslog Java Client with Maven 
 

From f29597fb469326bbc046010786edd5b81c4c83ff Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Fri, 6 Oct 2017 10:43:22 +0200
Subject: [PATCH 11/44] [maven-release-plugin] prepare release
 syslog-java-client-1.1.1

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index e99f084..2549568 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>1.1.1</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>HEAD</tag>
+      <tag>syslog-java-client-1.1.1</tag>
   </scm>
     <dependencies>
         <dependency>

From ae70a1f57298714836b617cc0769d791c8ee2e60 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Fri, 6 Oct 2017 10:43:28 +0200
Subject: [PATCH 12/44] [maven-release-plugin] prepare for next development
 iteration

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2549568..c54c027 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.1</version>
+    <version>1.1.2-SNAPSHOT</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>syslog-java-client-1.1.1</tag>
+      <tag>HEAD</tag>
   </scm>
     <dependencies>
         <dependency>

From 168162e403b5e32ffe877fccf2c512f94c595160 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 1 Nov 2017 10:47:12 -0700
Subject: [PATCH 13/44] Fix #19 NullPointerException in
 TcpSyslogMessageSender#toString()

---
 .../cloudbees/syslog/sender/TcpSyslogMessageSender.java   | 2 ++
 .../syslog/sender/TcpSyslogMessageSenderTest.java         | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
index c9a94ca..e16baa6 100644
--- a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
@@ -206,6 +206,8 @@ public void setSyslogServerPort(int syslogServerPort) {
 
     @Nullable
     public String getSyslogServerHostname() {
+        if (syslogServerHostnameReference == null)
+            return null;
         InetAddress inetAddress = syslogServerHostnameReference.get();
         return inetAddress == null ? null : inetAddress.getHostName();
     }
diff --git a/src/test/java/com/cloudbees/syslog/sender/TcpSyslogMessageSenderTest.java b/src/test/java/com/cloudbees/syslog/sender/TcpSyslogMessageSenderTest.java
index 19da4c9..0889109 100644
--- a/src/test/java/com/cloudbees/syslog/sender/TcpSyslogMessageSenderTest.java
+++ b/src/test/java/com/cloudbees/syslog/sender/TcpSyslogMessageSenderTest.java
@@ -92,4 +92,12 @@ public void sendOverSSL() throws Exception {
     }
 
 
+    /**
+     * https://github.com/CloudBees-community/syslog-java-client/issues/19
+     */
+    @Test
+    public void test_bug19_NullPointerException_In_ToString(){
+        TcpSyslogMessageSender tcpSyslogMessageSender = new TcpSyslogMessageSender();
+        tcpSyslogMessageSender.toString();
+    }
 }

From 2be6895c8e2c139f7f4e01f11263a98e5dd83d48 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 1 Nov 2017 10:48:39 -0700
Subject: [PATCH 14/44] [maven-release-plugin] prepare release
 syslog-java-client-1.1.2

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index c54c027..9026a10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.2-SNAPSHOT</version>
+    <version>1.1.2</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>HEAD</tag>
+      <tag>syslog-java-client-1.1.2</tag>
   </scm>
     <dependencies>
         <dependency>

From 57617f5a5515c1c1fe59b5cec70e5d650033726b Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 1 Nov 2017 10:48:48 -0700
Subject: [PATCH 15/44] [maven-release-plugin] prepare for next development
 iteration

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9026a10..e01e6d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.2</version>
+    <version>1.1.3-SNAPSHOT</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>syslog-java-client-1.1.2</tag>
+      <tag>HEAD</tag>
   </scm>
     <dependencies>
         <dependency>

From fed60cf06497cd92db85883afaa8621bb7db0918 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 1 Nov 2017 10:56:58 -0700
Subject: [PATCH 16/44] Update readme

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index c2b6b86..19a0ecb 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ Add the following dependency in your pom.xml:
 <dependency>
     <groupId>com.cloudbees</groupId>
     <artifactId>syslog-java-client</artifactId>
-    <version>1.1.0</version>
+    <version>1.1.2</version>
 </dependency>
 ```
 

From 700bf109415534e47fb6a92ecb02cd9460cd42f0 Mon Sep 17 00:00:00 2001
From: Spyros Pachomis <spyros.pachomis@sapienzaconsulting.com>
Date: Fri, 29 Jun 2018 17:13:27 +0200
Subject: [PATCH 17/44] Fix #23 Priority calculation for rfc3164

---
 src/main/java/com/cloudbees/syslog/SyslogMessage.java     | 2 +-
 src/test/java/com/cloudbees/syslog/SyslogMessageTest.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/cloudbees/syslog/SyslogMessage.java b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
index b407845..f9a4e6d 100755
--- a/src/main/java/com/cloudbees/syslog/SyslogMessage.java
+++ b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
@@ -341,7 +341,7 @@ public String toRfc3164SyslogMessage() {
      */
     public void toRfc3164SyslogMessage(Writer out) throws IOException {
 
-        int pri = facility.numericalCode() + severity.numericalCode();
+        int pri = facility.numericalCode() * 8 + severity.numericalCode();
 
         out.write('<');
         out.write(Integer.toString(pri));
diff --git a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
index f1ab066..576ed77 100755
--- a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
+++ b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
@@ -111,7 +111,7 @@ public void testRfc3164Format() throws Exception {
                 .withMsg("a syslog message");
 
         String actual = message.toRfc3164SyslogMessage();
-        String expected = "<7>Dec 05 10:30:05 myserver.example.com my_app: a syslog message";
+        String expected = "<14>Dec 05 10:30:05 myserver.example.com my_app: a syslog message";
 
         assertThat(actual, is(expected));
 

From 3612a77fffa158efe28cea346da8388dd355d920 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 4 Jul 2018 09:59:36 +0200
Subject: [PATCH 18/44] [maven-release-plugin] prepare release
 syslog-java-client-1.1.3

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index e01e6d1..7cadca6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.1.3</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>HEAD</tag>
+      <tag>syslog-java-client-1.1.3</tag>
   </scm>
     <dependencies>
         <dependency>

From 3723853af0f38db6270ddbf581ae6a9c8f8465ad Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 4 Jul 2018 09:59:43 +0200
Subject: [PATCH 19/44] [maven-release-plugin] prepare for next development
 iteration

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 7cadca6..88a6a7e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.3</version>
+    <version>1.1.4-SNAPSHOT</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>syslog-java-client-1.1.3</tag>
+      <tag>HEAD</tag>
   </scm>
     <dependencies>
         <dependency>

From 8296e34faffa2f7959b19c31218da72011fba797 Mon Sep 17 00:00:00 2001
From: Sylvain Brocard <sbrocard@enovacom.fr>
Date: Mon, 10 Sep 2018 15:21:04 +0200
Subject: [PATCH 20/44] Add support for RFC 5425

---
 .../com/cloudbees/syslog/MessageFormat.java   |  6 +++-
 .../com/cloudbees/syslog/SyslogMessage.java   | 36 +++++++++++++++++++
 .../cloudbees/syslog/SyslogMessageTest.java   | 29 +++++++++++++++
 3 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/cloudbees/syslog/MessageFormat.java b/src/main/java/com/cloudbees/syslog/MessageFormat.java
index 5e03f09..23f336e 100644
--- a/src/main/java/com/cloudbees/syslog/MessageFormat.java
+++ b/src/main/java/com/cloudbees/syslog/MessageFormat.java
@@ -28,5 +28,9 @@ public enum MessageFormat {
     /**
      * <a href="https://tools.ietf.org/html/rfc5424">RFC 5424 - The Syslog Protocol</a>
      */
-    RFC_5424
+    RFC_5424,
+    /**
+     * <a href="https://tools.ietf.org/html/rfc5425">RFC 5425 - Transport Layer Security (TLS) Transport Mapping for Syslog</a>
+     */
+    RFC_5425
 }
diff --git a/src/main/java/com/cloudbees/syslog/SyslogMessage.java b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
index f9a4e6d..8c96083 100755
--- a/src/main/java/com/cloudbees/syslog/SyslogMessage.java
+++ b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
@@ -17,12 +17,15 @@
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+
+import java.io.ByteArrayOutputStream;
 import java.io.CharArrayWriter;
 import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.nio.charset.StandardCharsets;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.Locale;
@@ -249,6 +252,8 @@ public String toSyslogMessage(MessageFormat messageFormat) {
                 return toRfc3164SyslogMessage();
             case RFC_5424:
                 return toRfc5424SyslogMessage();
+            case RFC_5425:
+                return toRfc5425SyslogMessage();
             default:
                 throw new IllegalStateException("Unsupported message format '" + messageFormat + "'");
         }
@@ -269,11 +274,42 @@ public void toSyslogMessage(@Nonnull MessageFormat messageFormat, @Nonnull Write
             case RFC_5424:
                 toRfc5424SyslogMessage(out);
                 break;
+            case RFC_5425:
+                toRfc5425SyslogMessage(out);
+                break;
             default:
                 throw new IllegalStateException("Unsupported message format '" + messageFormat + "'");
         }
     }
 
+    /**
+     * Generates an <a href="http://tools.ietf.org/html/rfc5424">RFC-5425</a> message.
+     */
+    public String toRfc5425SyslogMessage() {
+
+        StringWriter sw = new StringWriter(msg == null ? 32 : msg.size() + 32);
+        try {
+            toRfc5425SyslogMessage(sw);
+        } catch (IOException e) {
+            throw new IllegalStateException(e);
+        }
+        return sw.toString();
+    }
+
+    /**
+     * Generates an <a href="http://tools.ietf.org/html/rfc5425">RFC-5425</a> message.
+     */
+    public void toRfc5425SyslogMessage(Writer out) throws IOException {
+
+        StringWriter sw = new StringWriter(msg == null ? 32 : msg.size() + 32);
+        toRfc5424SyslogMessage(sw);
+        String rfc5424Message = sw.toString();
+        int length = rfc5424Message.getBytes(StandardCharsets.UTF_8).length;
+        out.write(String.valueOf(length));
+        out.write(SP);
+        out.write(rfc5424Message);
+    }
+
     /**
      * Generates an <a href="http://tools.ietf.org/html/rfc5424">RFC-5424</a> message.
      */
diff --git a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
index 576ed77..3f615cb 100755
--- a/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
+++ b/src/test/java/com/cloudbees/syslog/SyslogMessageTest.java
@@ -28,6 +28,35 @@
  */
 public class SyslogMessageTest {
 
+    @Test
+    public void testRfc5425Format() throws Exception {
+        // GIVEN
+        Calendar cal = Calendar.getInstance();
+        cal.setTimeZone(TimeZone.getTimeZone("GMT"));
+        cal.set(2013, Calendar.DECEMBER, 5, 10, 30, 5);
+        cal.set(Calendar.MILLISECOND, 0);
+
+        System.out.println(SyslogMessage.rfc3339DateFormat.format(cal.getTime()));
+        System.out.println(cal.getTimeInMillis());
+
+
+        SyslogMessage message = new SyslogMessage()
+            .withTimestamp(cal.getTimeInMillis())
+            .withAppName("my_app")
+            .withHostname("myserver.example.com")
+            .withFacility(Facility.USER)
+            .withSeverity(Severity.INFORMATIONAL)
+            .withTimestamp(cal.getTimeInMillis())
+            .withMsg("a syslog message");
+
+        // WHEN
+        String actual = message.toRfc5425SyslogMessage();
+
+        // THEN
+        String expected = "81 <14>1 2013-12-05T10:30:05.000Z myserver.example.com my_app - - - a syslog message";
+        assertThat(actual, is(expected));
+    }
+
     @Test
     public void testRfc5424Format() throws Exception {
 

From e92c60c861a4800847ae143c56e4168a8741f4d0 Mon Sep 17 00:00:00 2001
From: Sylvain Brocard <sbrocard@enovacom.fr>
Date: Mon, 10 Sep 2018 15:39:29 +0200
Subject: [PATCH 21/44] Add support for RFC 5425

Remove unused import and simplify code
---
 src/main/java/com/cloudbees/syslog/SyslogMessage.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/main/java/com/cloudbees/syslog/SyslogMessage.java b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
index 8c96083..765ccb2 100755
--- a/src/main/java/com/cloudbees/syslog/SyslogMessage.java
+++ b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
@@ -18,7 +18,6 @@
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import java.io.ByteArrayOutputStream;
 import java.io.CharArrayWriter;
 import java.io.IOException;
 import java.io.StringWriter;
@@ -301,9 +300,7 @@ public String toRfc5425SyslogMessage() {
      */
     public void toRfc5425SyslogMessage(Writer out) throws IOException {
 
-        StringWriter sw = new StringWriter(msg == null ? 32 : msg.size() + 32);
-        toRfc5424SyslogMessage(sw);
-        String rfc5424Message = sw.toString();
+        String rfc5424Message = toRfc5424SyslogMessage();
         int length = rfc5424Message.getBytes(StandardCharsets.UTF_8).length;
         out.write(String.valueOf(length));
         out.write(SP);

From d46567469733a8192531d1a2e0105b3742850a44 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Thu, 13 Sep 2018 23:11:20 +0200
Subject: [PATCH 22/44] [maven-release-plugin] prepare release
 syslog-java-client-1.1.4

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 88a6a7e..71132ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.4-SNAPSHOT</version>
+    <version>1.1.4</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>HEAD</tag>
+      <tag>syslog-java-client-1.1.4</tag>
   </scm>
     <dependencies>
         <dependency>

From 5f4527ad65cd7b9e1e13451cb1b21fb8087673c1 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Thu, 13 Sep 2018 23:11:28 +0200
Subject: [PATCH 23/44] [maven-release-plugin] prepare for next development
 iteration

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 71132ca..ded4e05 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.4</version>
+    <version>1.1.5-SNAPSHOT</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>syslog-java-client-1.1.4</tag>
+      <tag>HEAD</tag>
   </scm>
     <dependencies>
         <dependency>

From 7782fda855973dbc565fca85221fdd24e2de6615 Mon Sep 17 00:00:00 2001
From: Lijun Liao <lijun.liao@gmail.com>
Date: Fri, 14 Sep 2018 08:40:15 +0200
Subject: [PATCH 24/44] add the OSGi bundle header to jar file

---
 pom.xml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index ded4e05..1714a14 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     </parent>
 
     <artifactId>syslog-java-client</artifactId>
-    <packaging>jar</packaging>
+    <packaging>bundle</packaging>
     <version>1.1.5-SNAPSHOT</version>
 
     <name>syslog-java-client</name>
@@ -86,6 +86,12 @@
                     <target>1.7</target>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>3.5.1</version>
+                <extensions>true</extensions>
+            </plugin>
         </plugins>
     </build>
 </project>

From 23c1052be4a8f776908b8c22342460d70134f3a5 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Fri, 14 Sep 2018 14:14:58 +0200
Subject: [PATCH 25/44] Better readme, include sample for RFC-5425

---
 README.md | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 19a0ecb..802f454 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ Client library written in Java to send messages to a Syslog server.
  * `SyslogMessageSender`: send messages to a Syslog Server. Support implementations
    * `UdpSyslogMessageSender`: [RFC 3164 - The BSD syslog Protocol](http://tools.ietf.org/html/rfc3164) and [RFC 5426 - Transmission of Syslog Messages over UDP](http://tools.ietf.org/html/rfc5426)
    * `TcpSyslogMessageSender`: [RFC 6587 - Transmission of Syslog Messages over TCP](http://tools.ietf.org/html/rfc5426) (including SSL support)
+   * `TcpSyslogMessageSender`: [RFC 5425 - Transport Layer Security (TLS) Transport Mapping for Syslog](http://tools.ietf.org/html/rfc5426) (including SSL support)
  * `com.cloudbees.syslog.integration.jul.SyslogHandler`: java.util.logging handler to output log messages to a Syslog server.
 
 ## Release Notes
@@ -21,7 +22,7 @@ Add the following dependency in your pom.xml:
 <dependency>
     <groupId>com.cloudbees</groupId>
     <artifactId>syslog-java-client</artifactId>
-    <version>1.1.2</version>
+    <version>1.1.4</version>
 </dependency>
 ```
 
@@ -36,7 +37,8 @@ messageSender.setDefaultAppName("myapp");
 messageSender.setDefaultFacility(Facility.USER);
 messageSender.setDefaultSeverity(Severity.INFORMATIONAL);
 messageSender.setSyslogServerHostname("127.0.0.1");
-messageSender.setSyslogServerPort(1234);
+// syslog udp usually uses port 514 as per https://tools.ietf.org/html/rfc3164#page-5
+messageSender.setSyslogServerPort(514);
 messageSender.setMessageFormat(MessageFormat.RFC_3164); // optional, default is RFC 3164
 
 
@@ -99,3 +101,23 @@ messageSender.setSsl(true);
 // send a Syslog message
 messageSender.sendMessage("This is a test message");
 ```
+
+## Sample TCP over SSL sender using RFC 5425
+
+```java
+
+// Initialise sender
+TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
+messageSender.setDefaultMessageHostname("myhostname"); // some syslog cloud services may use this field to transmit a secret key
+messageSender.setDefaultAppName("myapp");
+messageSender.setDefaultFacility(Facility.USER);
+messageSender.setDefaultSeverity(Severity.INFORMATIONAL);
+messageSender.setSyslogServerHostname("127.0.0.1");
+// syslog-tls usually uses port 6514 as per https://tools.ietf.org/html/rfc5425#page-11
+messageSender.setSyslogServerPort(6514);
+messageSender.setMessageFormat(MessageFormat.RFC_5425);
+messageSender.setSsl(true);
+
+// send a Syslog message
+messageSender.sendMessage("This is a test message");
+```

From 9ac9a92fb07945da253f4fafbe9134fea36ede39 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Sun, 16 Sep 2018 20:04:46 -0700
Subject: [PATCH 26/44] add maven wrapper

---
 .gitignore                               |  11 +-
 .mvn/wrapper/MavenWrapperDownloader.java | 110 +++++++++
 .mvn/wrapper/maven-wrapper.properties    |   1 +
 mvnw                                     | 286 +++++++++++++++++++++++
 mvnw.cmd                                 | 161 +++++++++++++
 5 files changed, 568 insertions(+), 1 deletion(-)
 create mode 100755 .mvn/wrapper/MavenWrapperDownloader.java
 create mode 100755 .mvn/wrapper/maven-wrapper.properties
 create mode 100755 mvnw
 create mode 100755 mvnw.cmd

diff --git a/.gitignore b/.gitignore
index 47a45ce..b0b45d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,13 @@
-target
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
 
 .idea
 *.iml
diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java
new file mode 100755
index 0000000..fa4f7b4
--- /dev/null
+++ b/.mvn/wrapper/MavenWrapperDownloader.java
@@ -0,0 +1,110 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+    /**
+     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+     */
+    private static final String DEFAULT_DOWNLOAD_URL =
+            "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
+
+    /**
+     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+     * use instead of the default one.
+     */
+    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+            ".mvn/wrapper/maven-wrapper.properties";
+
+    /**
+     * Path where the maven-wrapper.jar will be saved to.
+     */
+    private static final String MAVEN_WRAPPER_JAR_PATH =
+            ".mvn/wrapper/maven-wrapper.jar";
+
+    /**
+     * Name of the property which should be used to override the default download url for the wrapper.
+     */
+    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+    public static void main(String args[]) {
+        System.out.println("- Downloader started");
+        File baseDirectory = new File(args[0]);
+        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+        // If the maven-wrapper.properties exists, read it and check if it contains a custom
+        // wrapperUrl parameter.
+        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+        String url = DEFAULT_DOWNLOAD_URL;
+        if(mavenWrapperPropertyFile.exists()) {
+            FileInputStream mavenWrapperPropertyFileInputStream = null;
+            try {
+                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+                Properties mavenWrapperProperties = new Properties();
+                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+            } catch (IOException e) {
+                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+            } finally {
+                try {
+                    if(mavenWrapperPropertyFileInputStream != null) {
+                        mavenWrapperPropertyFileInputStream.close();
+                    }
+                } catch (IOException e) {
+                    // Ignore ...
+                }
+            }
+        }
+        System.out.println("- Downloading from: : " + url);
+
+        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+        if(!outputFile.getParentFile().exists()) {
+            if(!outputFile.getParentFile().mkdirs()) {
+                System.out.println(
+                        "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+            }
+        }
+        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+        try {
+            downloadFileFromURL(url, outputFile);
+            System.out.println("Done");
+            System.exit(0);
+        } catch (Throwable e) {
+            System.out.println("- Error downloading");
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+        URL website = new URL(urlString);
+        ReadableByteChannel rbc;
+        rbc = Channels.newChannel(website.openStream());
+        FileOutputStream fos = new FileOutputStream(destination);
+        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+        fos.close();
+        rbc.close();
+    }
+
+}
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100755
index 0000000..00d32aa
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
\ No newline at end of file
diff --git a/mvnw b/mvnw
new file mode 100755
index 0000000..5551fde
--- /dev/null
+++ b/mvnw
@@ -0,0 +1,286 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven2 Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+#   JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+#   M2_HOME - location of maven2's installed home dir
+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
+#     e.g. to debug Maven itself, use
+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+  if [ -f /etc/mavenrc ] ; then
+    . /etc/mavenrc
+  fi
+
+  if [ -f "$HOME/.mavenrc" ] ; then
+    . "$HOME/.mavenrc"
+  fi
+
+fi
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+  CYGWIN*) cygwin=true ;;
+  MINGW*) mingw=true;;
+  Darwin*) darwin=true
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+    if [ -z "$JAVA_HOME" ]; then
+      if [ -x "/usr/libexec/java_home" ]; then
+        export JAVA_HOME="`/usr/libexec/java_home`"
+      else
+        export JAVA_HOME="/Library/Java/Home"
+      fi
+    fi
+    ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+  if [ -r /etc/gentoo-release ] ; then
+    JAVA_HOME=`java-config --jre-home`
+  fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+  ## resolve links - $0 may be a link to maven's home
+  PRG="$0"
+
+  # need this for relative symlinks
+  while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+      PRG="$link"
+    else
+      PRG="`dirname "$PRG"`/$link"
+    fi
+  done
+
+  saveddir=`pwd`
+
+  M2_HOME=`dirname "$PRG"`/..
+
+  # make it fully qualified
+  M2_HOME=`cd "$M2_HOME" && pwd`
+
+  cd "$saveddir"
+  # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --unix "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+  # TODO classpath?
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+  javaExecutable="`which javac`"
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+    # readlink(1) is not available as standard on Solaris 10.
+    readLink=`which readlink`
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+      if $darwin ; then
+        javaHome="`dirname \"$javaExecutable\"`"
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+      else
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
+      fi
+      javaHome="`dirname \"$javaExecutable\"`"
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+      JAVA_HOME="$javaHome"
+      export JAVA_HOME
+    fi
+  fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+  if [ -n "$JAVA_HOME"  ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+      JAVACMD="$JAVA_HOME/bin/java"
+    fi
+  else
+    JAVACMD="`which java`"
+  fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly." >&2
+  echo "  We cannot execute $JAVACMD" >&2
+  exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+  echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+  if [ -z "$1" ]
+  then
+    echo "Path not specified to find_maven_basedir"
+    return 1
+  fi
+
+  basedir="$1"
+  wdir="$1"
+  while [ "$wdir" != '/' ] ; do
+    if [ -d "$wdir"/.mvn ] ; then
+      basedir=$wdir
+      break
+    fi
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+    if [ -d "${wdir}" ]; then
+      wdir=`cd "$wdir/.."; pwd`
+    fi
+    # end of workaround
+  done
+  echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+  if [ -f "$1" ]; then
+    echo "$(tr -s '\n' ' ' < "$1")"
+  fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+  exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
+    fi
+else
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+    fi
+    jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
+    while IFS="=" read key value; do
+      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+      esac
+    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Downloading from: $jarUrl"
+    fi
+    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+
+    if command -v wget > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found wget ... using wget"
+        fi
+        wget "$jarUrl" -O "$wrapperJarPath"
+    elif command -v curl > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found curl ... using curl"
+        fi
+        curl -o "$wrapperJarPath" "$jarUrl"
+    else
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Falling back to using Java to download"
+        fi
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+        if [ -e "$javaClass" ]; then
+            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Compiling MavenWrapperDownloader.java ..."
+                fi
+                # Compiling the Java class
+                ("$JAVA_HOME/bin/javac" "$javaClass")
+            fi
+            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                # Running the downloader
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Running MavenWrapperDownloader.java ..."
+                fi
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+            fi
+        fi
+    fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+  echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+  $MAVEN_OPTS \
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mvnw.cmd b/mvnw.cmd
new file mode 100755
index 0000000..48363fa
--- /dev/null
+++ b/mvnw.cmd
@@ -0,0 +1,161 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM    http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven2 Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM     e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
+FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
+	IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+    echo Found %WRAPPER_JAR%
+) else (
+    echo Couldn't find %WRAPPER_JAR%, downloading it ...
+	echo Downloading from: %DOWNLOAD_URL%
+    powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
+    echo Finished downloading %WRAPPER_JAR%
+)
+@REM End of extension
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%

From 52bd3b5a7e6334504f639c2da29b5688ae4ef439 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Sun, 16 Sep 2018 20:07:09 -0700
Subject: [PATCH 27/44] refresh pom

---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1714a14..b58833f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,7 +46,7 @@
     </developers>
 
     <prerequisites>
-        <maven>3.2.1</maven>
+        <maven>3.5.0</maven>
     </prerequisites>
 
     <scm>
@@ -80,7 +80,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.2</version>
+                <version>3.8.0</version>
                 <configuration>
                     <source>1.7</source>
                     <target>1.7</target>
@@ -89,7 +89,7 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>3.5.1</version>
+                <version>4.0.0</version>
                 <extensions>true</extensions>
             </plugin>
         </plugins>

From 38662d4060e3438547c8842fb2184bbc91f88eed Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Sun, 16 Sep 2018 20:20:10 -0700
Subject: [PATCH 28/44] [maven-release-plugin] prepare release
 syslog-java-client-1.1.5

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index b58833f..b9f2bfc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.5-SNAPSHOT</version>
+    <version>1.1.5</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>HEAD</tag>
+      <tag>syslog-java-client-1.1.5</tag>
   </scm>
     <dependencies>
         <dependency>

From 8b825f9a506eaf188e14fec38b0e37218b1ceea0 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Sun, 16 Sep 2018 20:20:20 -0700
Subject: [PATCH 29/44] [maven-release-plugin] prepare for next development
 iteration

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index b9f2bfc..dc27619 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.5</version>
+    <version>1.1.6-SNAPSHOT</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>syslog-java-client-1.1.5</tag>
+      <tag>HEAD</tag>
   </scm>
     <dependencies>
         <dependency>

From 7b98bb0dbb442c10e414d9d8108b6fcb614dae1e Mon Sep 17 00:00:00 2001
From: Nick Couchman <nick_couchman@cotyinc.com>
Date: Tue, 8 Jan 2019 12:32:42 -0500
Subject: [PATCH 30/44] Stub out methods for hostname and port in the
 AbstractSyslogMessageSender class.

---
 .../sender/AbstractSyslogMessageSender.java     | 17 +++++++++++++++++
 .../syslog/sender/TcpSyslogMessageSender.java   |  2 ++
 .../syslog/sender/UdpSyslogMessageSender.java   |  2 ++
 3 files changed, 21 insertions(+)

diff --git a/src/main/java/com/cloudbees/syslog/sender/AbstractSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/AbstractSyslogMessageSender.java
index 880968e..395b2a2 100644
--- a/src/main/java/com/cloudbees/syslog/sender/AbstractSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/AbstractSyslogMessageSender.java
@@ -133,6 +133,23 @@ public void setMessageFormat(MessageFormat messageFormat) {
     public void setDefaultSeverity(Severity defaultSeverity) {
         this.defaultSeverity = defaultSeverity;
     }
+    
+    /**
+     * Set the hostname or IP of the syslog server to which messages will be
+     * sent.
+     * 
+     * @param syslogServerHostname 
+     *     The hostname or IP address of the syslog server.
+     */
+    public abstract void setSyslogServerHostname(final String syslogServerHostname);
+    
+    /**
+     * Set the port number of the syslog server to which messages will be sent.
+     * 
+     * @param syslogServerPort
+     *     The port to which syslog messages will be sent.
+     */
+    public abstract void setSyslogServerPort(int syslogServerPort);
 
     @Override
     public String toString() {
diff --git a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
index e16baa6..c07dc26 100644
--- a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
@@ -186,6 +186,7 @@ private synchronized void ensureSyslogServerConnection() throws IOException {
         }
     }
 
+    @Override
     public void setSyslogServerHostname(final String syslogServerHostname) {
         this.syslogServerHostnameReference = new CachingReference<InetAddress>(DEFAULT_INET_ADDRESS_TTL_IN_NANOS) {
             @Nullable
@@ -200,6 +201,7 @@ protected InetAddress newObject() {
         };
     }
 
+    @Override
     public void setSyslogServerPort(int syslogServerPort) {
         this.syslogServerPort = syslogServerPort;
     }
diff --git a/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java
index ced0e74..2a876eb 100644
--- a/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java
@@ -102,6 +102,7 @@ public void sendMessage(SyslogMessage message) throws IOException {
     }
 
 
+    @Override
     public void setSyslogServerHostname(final String syslogServerHostname) {
         this.syslogServerHostnameReference = new CachingReference<InetAddress>(DEFAULT_INET_ADDRESS_TTL_IN_NANOS) {
             @Nullable
@@ -116,6 +117,7 @@ protected InetAddress newObject() {
         };
     }
 
+    @Override
     public void setSyslogServerPort(int syslogServerPort) {
         this.syslogServerPort = syslogServerPort;
     }

From c9b9107772a2f66f9b03cd6c7141538c69f2d895 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 8 Jan 2019 22:50:19 +0100
Subject: [PATCH 31/44] Use SpotBugs

---
 pom.xml                                       | 20 ++++++++++++++++---
 .../java/com/cloudbees/syslog/SDElement.java  |  7 ++-----
 .../com/cloudbees/syslog/SyslogMessage.java   | 14 ++++++-------
 .../jul/util/LogManagerHelper.java            | 19 +++++++++++++++++-
 .../syslog/sender/TcpSyslogMessageSender.java |  2 +-
 .../syslog/util/ConcurrentDateFormat.java     |  3 +++
 .../cloudbees/syslog/util/InternalLogger.java |  7 ++++---
 7 files changed, 52 insertions(+), 20 deletions(-)

diff --git a/pom.xml b/pom.xml
index dc27619..837591c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,9 +57,9 @@
   </scm>
     <dependencies>
         <dependency>
-            <groupId>com.google.code.findbugs</groupId>
-            <artifactId>jsr305</artifactId>
-            <version>3.0.0</version>
+            <groupId>com.github.spotbugs</groupId>
+            <artifactId>spotbugs-annotations</artifactId>
+            <version>3.1.10</version>
             <optional>true</optional>
         </dependency>
         <dependency>
@@ -92,6 +92,20 @@
                 <version>4.0.0</version>
                 <extensions>true</extensions>
             </plugin>
+            <plugin>
+                <groupId>com.github.spotbugs</groupId>
+                <artifactId>spotbugs-maven-plugin</artifactId>
+                <version>3.1.10</version>
+                <executions>
+                    <execution>
+                        <id>analyze-compile</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>
diff --git a/src/main/java/com/cloudbees/syslog/SDElement.java b/src/main/java/com/cloudbees/syslog/SDElement.java
index a9894ee..6607b41 100644
--- a/src/main/java/com/cloudbees/syslog/SDElement.java
+++ b/src/main/java/com/cloudbees/syslog/SDElement.java
@@ -18,6 +18,7 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 
@@ -33,11 +34,7 @@ public class SDElement implements Serializable {
     /**
      * Reserved SD-IDs as documented in <a href="https://www.rfc-editor.org/rfc/rfc5424.txt">RFC-5424</a>
      */
-    public static final String[] RESERVED_SDID = new String[]{
-        "timeQuality",
-        "origin",
-        "meta"
-    };
+    private final List<String> RESERVED_SDID = Collections.unmodifiableList(Arrays.asList("timeQuality", "origin", "meta"));
 
     public SDElement(String sdID) {
         validateSDID(sdID);
diff --git a/src/main/java/com/cloudbees/syslog/SyslogMessage.java b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
index 765ccb2..6d07d13 100755
--- a/src/main/java/com/cloudbees/syslog/SyslogMessage.java
+++ b/src/main/java/com/cloudbees/syslog/SyslogMessage.java
@@ -90,7 +90,7 @@ protected String newObject() {
 
     private Facility facility;
     private Severity severity;
-    private Date timestamp;
+    private Long timestamp;
     private String hostname;
     private String appName;
     private String procId;
@@ -129,20 +129,20 @@ public SyslogMessage withSeverity(Severity severity) {
     }
 
     public Date getTimestamp() {
-        return timestamp;
+        return timestamp == null ? null : new Date(timestamp);
     }
 
     public void setTimestamp(Date timestamp) {
-        this.timestamp = timestamp;
+        this.timestamp = (timestamp == null ? null : timestamp.getTime());
     }
 
     public SyslogMessage withTimestamp(long timestamp) {
-        this.timestamp = new Date(timestamp);
+        this.timestamp = timestamp;
         return this;
     }
 
     public SyslogMessage withTimestamp(Date timestamp) {
-        this.timestamp = timestamp;
+        this.timestamp = (timestamp == null ? null : timestamp.getTime());
         return this;
     }
 
@@ -336,7 +336,7 @@ public void toRfc5424SyslogMessage(Writer out) throws IOException {
         out.write('>');
         out.write('1'); // version
         out.write(SP);
-        out.write(rfc3339DateFormat.format(timestamp == null ? new Date() : timestamp)); // message time
+        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);
@@ -379,7 +379,7 @@ public void toRfc3164SyslogMessage(Writer out) throws IOException {
         out.write('<');
         out.write(Integer.toString(pri));
         out.write('>');
-        out.write(rfc3164DateFormat.format(timestamp == null ? new Date() : timestamp)); // message time
+        out.write(rfc3164DateFormat.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);
diff --git a/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java b/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java
index ddbf397..e1153fd 100644
--- a/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java
+++ b/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java
@@ -42,7 +42,9 @@ public class LogManagerHelper {
      */
     @Nullable
     public static Level getLevelProperty(@Nonnull LogManager manager, @Nonnull String name, @Nullable Level defaultValue) {
-
+        if (name == null) {
+            return defaultValue;
+        }
         String val = manager.getProperty(name);
         if (val == null) {
             return defaultValue;
@@ -61,6 +63,9 @@ public static Level getLevelProperty(@Nonnull LogManager manager, @Nonnull Strin
      */
     @Nullable
     public static Filter getFilterProperty(@Nonnull LogManager manager, @Nullable String name, @Nullable Filter defaultValue) {
+        if (name == null) {
+            return defaultValue;
+        }
         String val = manager.getProperty(name);
         try {
             if (val != null) {
@@ -85,6 +90,9 @@ public static Filter getFilterProperty(@Nonnull LogManager manager, @Nullable St
      * If the property is not defined or has problems we return the defaultValue.
      */
     public static Formatter getFormatterProperty(@Nonnull LogManager manager, @Nullable String name, @Nullable Formatter defaultValue) {
+        if (name == null) {
+            return defaultValue;
+        }
         String val = manager.getProperty(name);
         try {
             if (val != null) {
@@ -107,6 +115,9 @@ public static Formatter getFormatterProperty(@Nonnull LogManager manager, @Nulla
      * If the property is not defined we return the given default value.
      */
     public static String getStringProperty(@Nonnull LogManager manager, @Nullable String name, String defaultValue) {
+        if (name == null) {
+            return defaultValue;
+        }
         String val = manager.getProperty(name);
         if (val == null) {
             return defaultValue;
@@ -123,6 +134,9 @@ public static String getStringProperty(@Nonnull LogManager manager, @Nullable St
      * If the property is not defined or cannot be parsed we return the given default value.
      */
     public static int getIntProperty(@Nonnull LogManager manager, @Nullable String name, int defaultValue) {
+        if (name == null) {
+            return defaultValue;
+        }
         String val = manager.getProperty(name);
         if (val == null) {
             return defaultValue;
@@ -143,6 +157,9 @@ public static int getIntProperty(@Nonnull LogManager manager, @Nullable String n
      * If the property is not defined or cannot be parsed we return the given default value.
      */
     public static boolean getBooleanProperty(@Nonnull LogManager manager, @Nullable String name, boolean defaultValue) {
+        if (name == null) {
+            return defaultValue;
+        }
         String val = manager.getProperty(name);
         if (val == null) {
             return defaultValue;
diff --git a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
index c07dc26..193446a 100644
--- a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
@@ -246,7 +246,7 @@ public void setMaxRetryCount(int maxRetryCount) {
         this.maxRetryCount = maxRetryCount;
     }
 
-    public void setPostfix(String postfix) {
+    public synchronized void setPostfix(String postfix) {
         this.postfix = postfix;
     }
 
diff --git a/src/main/java/com/cloudbees/syslog/util/ConcurrentDateFormat.java b/src/main/java/com/cloudbees/syslog/util/ConcurrentDateFormat.java
index fc50bcb..0c23b01 100644
--- a/src/main/java/com/cloudbees/syslog/util/ConcurrentDateFormat.java
+++ b/src/main/java/com/cloudbees/syslog/util/ConcurrentDateFormat.java
@@ -15,6 +15,8 @@
  */
 package com.cloudbees.syslog.util;
 
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
 import javax.annotation.Nonnull;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -60,6 +62,7 @@ public ConcurrentDateFormat(String pattern, Locale locale, TimeZone timeZone, in
      * @return the formatted time string.
      */
     @Nonnull
+    @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
     public String format(@Nonnull Date date) {
         SimpleDateFormat dateFormat = dateFormats.poll();
         if (dateFormat == null) {
diff --git a/src/main/java/com/cloudbees/syslog/util/InternalLogger.java b/src/main/java/com/cloudbees/syslog/util/InternalLogger.java
index 9b85aa1..83f9c8a 100644
--- a/src/main/java/com/cloudbees/syslog/util/InternalLogger.java
+++ b/src/main/java/com/cloudbees/syslog/util/InternalLogger.java
@@ -17,6 +17,7 @@
 
 import com.cloudbees.syslog.integration.jul.util.LevelHelper;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -41,12 +42,12 @@ public class InternalLogger {
         }
     }
 
-    public static InternalLogger getLogger(@Nullable String name) {
+    public static InternalLogger getLogger(@Nonnull String name) {
         return new InternalLogger(name);
     }
 
-    public static InternalLogger getLogger(@Nullable Class clazz) {
-        return getLogger(clazz == null ? null : clazz.getName());
+    public static InternalLogger getLogger(@Nonnull Class clazz) {
+        return getLogger(clazz.getName());
     }
 
     public static Level getLevel() {

From a5cc71ef843f6188cf76d47e500e87d47dd47619 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 8 Jan 2019 22:52:52 +0100
Subject: [PATCH 32/44] Implement Closeable - fix #25

---
 .../com/cloudbees/syslog/sender/SyslogMessageSender.java  | 3 ++-
 .../cloudbees/syslog/sender/TcpSyslogMessageSender.java   | 8 +++++++-
 .../cloudbees/syslog/sender/UdpSyslogMessageSender.java   | 8 +++++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/cloudbees/syslog/sender/SyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/SyslogMessageSender.java
index fe59ba1..6e4b8ff 100644
--- a/src/main/java/com/cloudbees/syslog/sender/SyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/SyslogMessageSender.java
@@ -22,6 +22,7 @@
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.ThreadSafe;
 import java.io.CharArrayWriter;
+import java.io.Closeable;
 import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 
@@ -33,7 +34,7 @@
  * @author <a href="mailto:cleclerc@cloudbees.com">Cyrille Le Clerc</a>
  */
 @ThreadSafe
-public interface SyslogMessageSender {
+public interface SyslogMessageSender extends Closeable {
     public static final long DEFAULT_INET_ADDRESS_TTL_IN_MILLIS = TimeUnit.MILLISECONDS.convert(30, TimeUnit.SECONDS);
     public static final long DEFAULT_INET_ADDRESS_TTL_IN_NANOS = TimeUnit.NANOSECONDS.convert(DEFAULT_INET_ADDRESS_TTL_IN_MILLIS, TimeUnit.MILLISECONDS);
     public static final String DEFAULT_SYSLOG_HOST = "localhost";
diff --git a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
index 193446a..94a7709 100644
--- a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
@@ -27,6 +27,7 @@
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 import java.io.BufferedWriter;
+import java.io.Closeable;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
@@ -44,7 +45,7 @@
  * @author <a href="mailto:cleclerc@cloudbees.com">Cyrille Le Clerc</a>
  */
 @ThreadSafe
-public class TcpSyslogMessageSender extends AbstractSyslogMessageSender {
+public class TcpSyslogMessageSender extends AbstractSyslogMessageSender implements Closeable  {
     public final static int SETTING_SOCKET_CONNECT_TIMEOUT_IN_MILLIS_DEFAULT_VALUE = 500;
     public final static int SETTING_MAX_RETRY = 2;
 
@@ -269,4 +270,9 @@ public String toString() {
                 ", trySendErrorCounter=" + trySendErrorCounter +
                 '}';
     }
+
+    @Override
+    public void close() throws IOException {
+        this.socket.close();
+    }
 }
diff --git a/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java
index 2a876eb..4cd253c 100644
--- a/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java
@@ -21,6 +21,7 @@
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.ThreadSafe;
 import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
@@ -39,7 +40,7 @@
  * @author <a href="mailto:cleclerc@cloudbees.com">Cyrille Le Clerc</a>
  */
 @ThreadSafe
-public class UdpSyslogMessageSender extends AbstractSyslogMessageSender {
+public class UdpSyslogMessageSender extends AbstractSyslogMessageSender implements Closeable {
     /**
      * {@link java.net.InetAddress InetAddress} of the remote Syslog Server.
      *
@@ -147,4 +148,9 @@ public String toString() {
                 ", sendErrorCounter=" + sendErrorCounter +
                 '}';
     }
+
+    @Override
+    public void close() throws IOException {
+        this.datagramSocket.close();
+    }
 }

From 0a72fb078e824d310718395acc80b67ec00c22eb Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 8 Jan 2019 22:55:03 +0100
Subject: [PATCH 33/44] Implement Closeable - fix #25

---
 .../syslog/integration/jul/SyslogHandler.java          | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/cloudbees/syslog/integration/jul/SyslogHandler.java b/src/main/java/com/cloudbees/syslog/integration/jul/SyslogHandler.java
index a944c87..64d6ca9 100644
--- a/src/main/java/com/cloudbees/syslog/integration/jul/SyslogHandler.java
+++ b/src/main/java/com/cloudbees/syslog/integration/jul/SyslogHandler.java
@@ -119,12 +119,10 @@ public void flush() {
 
     @Override
     public void close() throws SecurityException {
-        if (syslogMessageSender instanceof Closeable) {
-            try {
-                ((Closeable) syslogMessageSender).close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
+        try {
+            syslogMessageSender.close();
+        } catch (IOException e) {
+            e.printStackTrace();
         }
     }
 

From b1334862dc33305339ab5c00b0c0d640abfa4f38 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 8 Jan 2019 22:59:09 +0100
Subject: [PATCH 34/44] Bump mvn wrapper

---
 .mvn/wrapper/maven-wrapper.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index 00d32aa..b6e6781 100755
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1 +1 @@
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
\ No newline at end of file
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
\ No newline at end of file

From e6649f0a370ce3afa8832b74437d6b21221cb71b Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 8 Jan 2019 23:02:18 +0100
Subject: [PATCH 35/44] Refresh pom.xml

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 837591c..1f00682 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>com.cloudbees</groupId>
         <artifactId>cloudbees-oss-parent</artifactId>
-        <version>7</version>
+        <version>8</version>
     </parent>
 
     <artifactId>syslog-java-client</artifactId>
@@ -89,7 +89,7 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>4.0.0</version>
+                <version>4.1.0</version>
                 <extensions>true</extensions>
             </plugin>
             <plugin>

From 295565331fc1c8728ffd3125a048f596138b6cac Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 8 Jan 2019 23:03:35 +0100
Subject: [PATCH 36/44] [maven-release-plugin] prepare release
 syslog-java-client-1.1.6

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1f00682..173c1e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.6-SNAPSHOT</version>
+    <version>1.1.6</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>HEAD</tag>
+      <tag>syslog-java-client-1.1.6</tag>
   </scm>
     <dependencies>
         <dependency>

From 1876f349c22b8c40f0643441fd65523e23e9b2bf Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 8 Jan 2019 23:03:42 +0100
Subject: [PATCH 37/44] [maven-release-plugin] prepare for next development
 iteration

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 173c1e7..eb7e5fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.6</version>
+    <version>1.1.7-SNAPSHOT</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>syslog-java-client-1.1.6</tag>
+      <tag>HEAD</tag>
   </scm>
     <dependencies>
         <dependency>

From 18f59232a348b125df01623ad4d7cdc8c4259746 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 8 Jan 2019 23:11:35 +0100
Subject: [PATCH 38/44] update readme.md

---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 802f454..8fcc7e0 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Client library written in Java to send messages to a Syslog server.
    * `TcpSyslogMessageSender`: [RFC 5425 - Transport Layer Security (TLS) Transport Mapping for Syslog](http://tools.ietf.org/html/rfc5426) (including SSL support)
  * `com.cloudbees.syslog.integration.jul.SyslogHandler`: java.util.logging handler to output log messages to a Syslog server.
 
-## Release Notes
+## Release Notes and downloads
 
 See https://github.com/CloudBees-community/syslog-java-client/releases/
 
@@ -22,7 +22,7 @@ Add the following dependency in your pom.xml:
 <dependency>
     <groupId>com.cloudbees</groupId>
     <artifactId>syslog-java-client</artifactId>
-    <version>1.1.4</version>
+    <version>1.1.6</version>
 </dependency>
 ```
 

From 45279350274a9a04f6ce83be3b6f00be414e8907 Mon Sep 17 00:00:00 2001
From: "BARCO\\FIRDU" <firat.dulger@barco.com>
Date: Tue, 15 Jan 2019 14:08:48 +0100
Subject: [PATCH 39/44] Use user-provided SSLContext to create secure socket

---
 .../syslog/sender/TcpSyslogMessageSender.java    | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
index 94a7709..b1d8c98 100644
--- a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
@@ -23,6 +23,7 @@
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.ThreadSafe;
 import javax.net.SocketFactory;
+import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
@@ -68,6 +69,7 @@ public class TcpSyslogMessageSender extends AbstractSyslogMessageSender implemen
     private Writer writer;
     private int socketConnectTimeoutInMillis = SETTING_SOCKET_CONNECT_TIMEOUT_IN_MILLIS_DEFAULT_VALUE;
     private boolean ssl;
+    private SSLContext sslContext;
     /**
      * Number of retries to send a message before throwing an exception.
      */
@@ -144,7 +146,11 @@ private synchronized void ensureSyslogServerConnection() throws IOException {
             writer = null;
             try {
                 if (ssl) {
-                    socket = SSLSocketFactory.getDefault().createSocket();
+                	if(sslContext == null) {
+                		socket = SSLSocketFactory.getDefault().createSocket();
+                	} else {
+                		socket = sslContext.getSocketFactory().createSocket();
+                	}
                 } else {
                     socket = SocketFactory.getDefault().createSocket();
                 }
@@ -226,6 +232,14 @@ public boolean isSsl() {
     public void setSsl(boolean ssl) {
         this.ssl = ssl;
     }
+    
+    public synchronized void setSSLContext(SSLContext sslContext) {
+        this.sslContext = sslContext; 
+    }
+    
+    public synchronized SSLContext getSSLContext() {
+        return this.sslContext; 
+    }
 
     public int getSocketConnectTimeoutInMillis() {
         return socketConnectTimeoutInMillis;

From 779c29956abfc6b53ebdc9074d38debebfb9eed5 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 15 Jan 2019 21:04:30 +0100
Subject: [PATCH 40/44] reformat

---
 .../syslog/sender/TcpSyslogMessageSender.java          | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
index b1d8c98..30859c6 100644
--- a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
+++ b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java
@@ -146,11 +146,11 @@ private synchronized void ensureSyslogServerConnection() throws IOException {
             writer = null;
             try {
                 if (ssl) {
-                	if(sslContext == null) {
-                		socket = SSLSocketFactory.getDefault().createSocket();
-                	} else {
-                		socket = sslContext.getSocketFactory().createSocket();
-                	}
+                    if (sslContext == null) {
+                        socket = SSLSocketFactory.getDefault().createSocket();
+                    } else {
+                        socket = sslContext.getSocketFactory().createSocket();
+                    }
                 } else {
                     socket = SocketFactory.getDefault().createSocket();
                 }

From 8ed62dc22f8531cac3f19e6f541eddbd304062cf Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 15 Jan 2019 21:07:05 +0100
Subject: [PATCH 41/44] [maven-release-plugin] prepare release
 syslog-java-client-1.1.7

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index eb7e5fe..c74ffb5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.7-SNAPSHOT</version>
+    <version>1.1.7</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>HEAD</tag>
+      <tag>syslog-java-client-1.1.7</tag>
   </scm>
     <dependencies>
         <dependency>

From eca08ac5654c3f93995ea57683b756955ef72ab7 Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 15 Jan 2019 21:07:20 +0100
Subject: [PATCH 42/44] [maven-release-plugin] prepare for next development
 iteration

---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index c74ffb5..c850f9c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
     <artifactId>syslog-java-client</artifactId>
     <packaging>bundle</packaging>
-    <version>1.1.7</version>
+    <version>1.1.8-SNAPSHOT</version>
 
     <name>syslog-java-client</name>
     <description>Syslog Java Client</description>
@@ -53,7 +53,7 @@
         <connection>scm:git:git://github.com/CloudBees-community/syslog-java-client.git</connection>
         <developerConnection>scm:git:git@github.com:CloudBees-community/syslog-java-client.git</developerConnection>
         <url>https://github.com/CloudBees-community/syslog-java-client</url>
-      <tag>syslog-java-client-1.1.7</tag>
+      <tag>HEAD</tag>
   </scm>
     <dependencies>
         <dependency>

From 41e01206e4ce17c6d225ffb443bf19792a3f3c3a Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Wed, 16 Jan 2019 16:01:51 +0100
Subject: [PATCH 43/44] Update README.md

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 8fcc7e0..a0efff6 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ Add the following dependency in your pom.xml:
 <dependency>
     <groupId>com.cloudbees</groupId>
     <artifactId>syslog-java-client</artifactId>
-    <version>1.1.6</version>
+    <version>1.1.7</version>
 </dependency>
 ```
 

From 4c166535b270c5dc7ff15b4efb66b7475b0262ea Mon Sep 17 00:00:00 2001
From: Cyrille Le Clerc <cleclerc@cloudbees.com>
Date: Tue, 11 Jun 2019 18:30:10 +0200
Subject: [PATCH 44/44] Fix typo on README.md fix #33 #32 #35

---
 README.md | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index a0efff6..18d6786 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,12 @@ Add the following dependency in your pom.xml:
 ## Sample UDP sender using RFC 3164
 
 ```java
+import com.cloudbees.syslog.Facility;
+import com.cloudbees.syslog.MessageFormat;
+import com.cloudbees.syslog.Severity;
+import com.cloudbees.syslog.sender.UdpSyslogMessageSender;
+
+...
 
 // Initialise sender
 UdpSyslogMessageSender messageSender = new UdpSyslogMessageSender();
@@ -41,7 +47,6 @@ messageSender.setSyslogServerHostname("127.0.0.1");
 messageSender.setSyslogServerPort(514);
 messageSender.setMessageFormat(MessageFormat.RFC_3164); // optional, default is RFC 3164
 
-
 // send a Syslog message
 messageSender.sendMessage("This is a test message");
 ```
@@ -49,9 +54,15 @@ messageSender.sendMessage("This is a test message");
 ## Sample UDP sender using RFC 5424
 
 ```java
+import com.cloudbees.syslog.Facility;
+import com.cloudbees.syslog.MessageFormat;
+import com.cloudbees.syslog.Severity;
+import com.cloudbees.syslog.sender.UdpSyslogMessageSender;
+
+...
 
 // Initialise sender
-SyslogMessageUdpSender messageSender = new SyslogMessageUdpSender();
+UdpSyslogMessageSender messageSender = new UdpSyslogMessageSender();
 messageSender.setDefaultMessageHostname("myhostname"); // some syslog cloud services may use this field to transmit a secret key
 messageSender.setDefaultAppName("myapp");
 messageSender.setDefaultFacility(Facility.USER);
@@ -67,6 +78,12 @@ messageSender.sendMessage("This is a test message");
 ## Sample TCP sender using RFC 3164
 
 ```java
+import com.cloudbees.syslog.Facility;
+import com.cloudbees.syslog.MessageFormat;
+import com.cloudbees.syslog.Severity;
+import com.cloudbees.syslog.sender.TcpSyslogMessageSender;
+
+...
 
 // Initialise sender
 TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
@@ -86,6 +103,12 @@ messageSender.sendMessage("This is a test message");
 ## Sample TCP over SSL sender using RFC 3164
 
 ```java
+import com.cloudbees.syslog.Facility;
+import com.cloudbees.syslog.MessageFormat;
+import com.cloudbees.syslog.Severity;
+import com.cloudbees.syslog.sender.TcpSyslogMessageSender;
+
+...
 
 // Initialise sender
 TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
@@ -105,6 +128,12 @@ messageSender.sendMessage("This is a test message");
 ## Sample TCP over SSL sender using RFC 5425
 
 ```java
+import com.cloudbees.syslog.Facility;
+import com.cloudbees.syslog.MessageFormat;
+import com.cloudbees.syslog.Severity;
+import com.cloudbees.syslog.sender.TcpSyslogMessageSender;
+
+...
 
 // Initialise sender
 TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
