[Mono-dev] local file based EventLog implementation

Gert Driesen gert.driesen at telenet.be
Tue Aug 8 07:50:13 EDT 2006



> -----Original Message-----
> From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-
> bounces at lists.ximian.com] On Behalf Of Atsushi Eno
> Sent: maandag 7 augustus 2006 3:58
> To: mono-devel-list at lists.ximian.com
> Subject: [Mono-dev] local file based EventLog implementation
> 
> Hi,
> 
> During a consultation with a local customer I recently noticed that we
> don't have EventLog implementation, while a basic framework has existed
> for years, which was intended to have some different implementations.
> Hence I implemented pretty simple stupid one, which works only for
> local machine.
> 
> I modified some of existing framework as it does not seem to support
> multiple implementation in reality.
> 
> To use this code, set MONO_LOCAL_EVENTLOG_DIR =
> /path/to/yourfavoritedir to point the location for aggregated event
> logs.
> 
> The usage sample I have is like:
> 
> 	EventLog log = new EventLog ("enolog", ".", "logg");
> 	Console.WriteLine (log.Log);
> 	foreach (EventLogEntry e in log.Entries)
> 		Console.WriteLine (e.Message);
> 	log.WriteEntry ("My test message.");
> 
> It is really a hack. Any improvements or suggestions would be
> appreciated. If no one is taking care of EventLog stuff, I'll checkin
> the code by myself.

I'm not sure if it's really necessary to have a separate EventLogFactory
abstraction, we could use a similar approach to the one used for the
Registry API;  meaning, define an interface and implementations of that
interface and have EventLog pick the implementation for doing all the work
(except for basic argument checks and stuff). Ofcourse, feel free to ignore
my remarks as I'm glad we now have at least an implementation thanks to you
;-)

We might also use the Registry API for registering/deleting/querying event
sources (on both linux and windows) to match the Win32 event log, which
AFAIK uses HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog to
store that info.

That way we would only need to implement reading/writing event log entries
itself in a platform specific way, and we could use your implementation for
linux (and perhaps for the time being also for windows).

Gert




More information about the Mono-devel-list mailing list