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

Michael Schurter michael at susens-schurter.com
Thu Feb 15 12:09:06 EST 2007


On Thu, 2007-02-15 at 17:39 +0100, Gert Driesen wrote:
> 
> > -----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.

Excellent!  I'd be interested in testing it or even help developing it.
(Although I'm a bit slow at navigating, building, and hacking the full
mono source tree... submitted a tiny patch once before and it took me a
while to figure everything out.)

Thanks again for all of your help!

Michael



More information about the Mono-list mailing list