[Mono-list] Nothing happens with mono-service and EventLog.WriteEntry

Gert Driesen gert.driesen at telenet.be
Thu Feb 15 11:39:08 EST 2007



> -----Original Message-----
> From: Michael Schurter [mailto:michael at susens-schurter.com]
> Sent: donderdag 15 februari 2007 16:35
> To: Gert Driesen
> Cc: 'mono-list'
> Subject: RE: [Mono-list] Nothing happens with mono-service and
> EventLog.WriteEntry
> 
> On Mon, 2007-02-12 at 22:06 +0100, Gert Driesen wrote:
> ...snip...
> > What part is clumsy about it ? I started working on an MWF gui for
> the
> > eventlog which basically is a light-weight version of the windows
> > EventViewer.
> 
> I guess I expected a syslog-like backend.  I find the EventLog in
> Windows a lot less useful and harder to read than syslog in general, so
> for me have a 100% accurate implementation is a bad thing.
> 
> However, I discovered this little snippet of code should keep Windows
> happy as well as give me the syslog support I love:
> 
> private void SmartLog (string message)
> {
> 	int p = (int) Environment.OSVersion.Platform;
> 	if ((p == 4) || (p == 128)) {
> 		// UNIX - Use Syslog
> 		Mono.Unix.Native.Syscall.syslog (
> 			Mono.Unix.Native.SyslogLevel.LOG_INFO,
> 			message);
> 		} else {
> 			// Windows - Use EventLog
> 			EventLog.WriteEntry (message);
> 		}
> 	}
> }
> 
> Obviously not the most "robust" solution, but its a quick and easy hack
> to make everyone happy!  ;)

I'll checkout the Mono.Unix API for Syslog and perhaps add support for using
it as a backend for event log.

Gert



More information about the Mono-list mailing list