How do I redirect trace information to syslog?

I want to override the default trace listener to route trace information to a syslog server.

I am using Kiwi Syslog server. At the moment I am posting to the syslog server using the nuget SyslogNet.Client 0.2.3 library.

var _syslogSender = new SyslogUdpSender("localhost", 514);
                _syslogSender.Send(
                    new SyslogMessage(
                        DateTime.Now,
                        Facility.SecurityOrAuthorizationMessages1,
                        Severity.Informational,
                        Environment.MachineName,
                        "Application Name",
                        "Message Content"),
                    new SyslogRfc5424MessageSerializer());

      

Instead of sending a message to the syslog server, I want to override the listener to send the message directly to syslog using trace information or error.

Basically, I want a listener to listen for trace information, and if something comes in trace information, it should be written to syslog.

+3


source to share





All Articles