[Mono-dev] local file based EventLog implementation
gert.driesen at telenet.be
Tue Aug 8 14:52:55 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: dinsdag 8 augustus 2006 19:47
> To: Gert Driesen
> Cc: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] local file based EventLog implementation
> 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
> >> 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
> >> 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
Yeah, we could ofcourse have an abstract base class, but I just didn't see
the need for implementing both a factory class and an EvenLogImpl.
But well, it's not that important.
> > 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.
I'll see if I can take a stab at this tomorrow.
> > 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
> Or, on windows we could just use windows event log API (if exists).
Yeah, partially (see my response to Kornél's post).
More information about the Mono-devel-list