[Mono-list] Re: About Event Log

Robert Jordan robertj at gmx.net
Thu Oct 20 10:36:27 EDT 2005


> Can't u implement the Evenlog in your next version to use the SystemLog on
> the Platform runing or a special log file for Mono only.

Even now you can use the EventLog: You may hook the EntryWritten
event and write the log entry using syslog(3):

using System;
using System.Diagnostics;
using Mono.Unix.Native;

class Test
         static void Main ()
                 EventLog log = new EventLog();
                 log.EnableRaisingEvents = true;
                 log.EntryWritten +=
                         new EntryWrittenEventHandler (HandleEvent);
                 log.WriteEntry ("Hello world!");

         static void HandleEvent (object sender, EntryWrittenEventArgs e)
                 Syscall.syslog (SyslogFacility.LOG_USER,


More information about the Mono-list mailing list