3

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

I am using Kiwi Syslog server. For now, I am sending message to syslog server using nuget library SyslogNet.Client 0.2.3.

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 message to syslog server I want to override listener to send the message directly to syslog using Trace Info or error.

Basically my need is I want a listener which will listen to Trace info and If anything comes in trace info it should write into syslog.

Manjay_TBAG
  • 2,176
  • 3
  • 23
  • 43
  • While technically a viable question, I would reconsider this approach if you really intent to redirect _all_ trace information to the syslog (except maybe for troubleshooting scenarios). The syslog (as the Windows EvenLog) should only contain message of relevance to a system administrator (operational, security, etc.) and not (application) traces. – Christian.K Jun 01 '15 at 09:32
  • Then you better discuss this idea with your operational staff :-) – Christian.K Jun 01 '15 at 09:35
  • @Christian.K Can you suggest me the way? I tried overriding TraceListener class and inside Write method I wrote above logic to send. Is it a bad approach. Can you suggest some good approach? – Manjay_TBAG Jun 01 '15 at 09:38

0 Answers0