Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down Expand Up @@ -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() + "{" +
Expand Down