[Mono-dev] [PATCH] New eventlog implementation

Gert Driesen gert.driesen at telenet.be
Mon Aug 14 17:07:30 EDT 2006


I've finished implementing the eventlog changes and incorporated
feedback by Atushi Eno (let me know if there's anything message).

We now have the following environment variables for configuring the
eventlog subsystem: 

- MONO_EVENTLOG_TYPE for setting the implementation type.

                Possible value are:
                * win32 : read/write entries using the native win32
                * local : read/write entries as files to a local
                * null  : silently ignore all entries

                The default is "null", meaning entries will be silently

                If the implementation is set to "local" and
                is not set, then the following directory will be used
                for storing eventlog entries:

                * windows : %APPDATA%\mono\eventlog
                * unix    : /var/lib/mono/eventlog

                On unix, the directory permission for indivual eventlog
                log directories is set to 777 (with +t bit) allowing
                everyone to read and write eventlog entries while only
                allowing entries to be deleted by the user(s) that
                created them.

- MONO_EVENTLOG_PATH for setting the local file path.

                If set, and MONO_EVENTLOG_IMPL is not set then the local
                file implementation is used.

- MONO_REGISTRY_MACHINE for setting the directory to use for storing the
machine-level registry hives.

                If not set, then the machine-level registry hives are
                stored in directory .mono/registry relative to the
                user's home directory.

                This applies to HKEY_LOCAL_MACHINE, HKEY_CURRENT_CONFIG,
                and HKEY_USERS.

For this last environment variable, I'll supply a separate patch once my
other registry changes have been approved (to avoid a patch nightmare).

A simple test application for the eventlog subsystem (by courtesy of
Atsushi Eno):

using System;
using System.Diagnostics;

public class Test
  public static void Main ()
    if (!EventLog.Exists ("enolog")) {
      EventLog.CreateEventSource ("enologue", "enolog");

    EventLog log = new EventLog ("enolog", ".", "enologue");
    foreach (EventLogEntry e in log.Entries)
      Console.WriteLine (e.Message);
    log.WriteEntry ("My test message.");

Note: set the MONO_EVENTLOG_TYPE environment variable to "local" if you
want the entries to be persisted to the local file store.

Let me know if there's anything that you want me to change, or if it's
ok to commit as such.

I'll update the man page once my patch is approved (but before I commit

Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: eventlog.patch
Type: text/x-patch
Size: 62501 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060814/40c38bc6/attachment.bin 

More information about the Mono-devel-list mailing list