[Mono-dev] local file based EventLog implementation

Atsushi Eno atsushi at ximian.com
Tue Aug 8 13:46:53 EDT 2006

Hi Gert,

Thanks for the comments.

Gert Driesen wrote:
>> -----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
> ;-)

I'm just curious, what's the benefit of your interface proposal over
factory methods? My guess is that we would end up to summarize common
code base into an abstract class, which will look like existing 

> 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.

Yeah, I didn't spend time to learn about the Win API / Registry, but
if someone spare time to implement registry based sources it'd be cool.

> 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).

Or, on windows we could just use windows event log API (if exists).

Atsushi Eno

More information about the Mono-devel-list mailing list