Syslog-based ILogWriter implementation

This sample shows how to implement a Syslog-based ILogWriter suitable for Rebex components.

The sample app negotiates a TLS session with server and logs the progress of the TLS negotiation to a specified Syslog server.


> SysLogWriter UDP localhost
> SysLogWriter TCP localhost:514


// derive from LogWriterBase
public class SysLogWriter : LogWriterBase
    private readonly SyslogClient _client = new SyslogClient();

    public SysLogWriter(string serverName, int port, SyslogTransportProtocol protocol)
        // connect to desired Syslog server
        _client.Connect(serverName, port, protocol);

    // implement logic by overriding WriteMessage()
    protected override void WriteMessage(string message)

    // handle dispose
    protected override void Dispose(bool disposing)
        if (disposing) _client.Close();