[Mono-dev] Event logging under Mono

Spyros Sakellariadis (MS OPEN TECH) spyros at microsoft.com
Mon Dec 8 22:38:26 UTC 2014

[Sorry if duplicate. I think I originally sent to wrong alias]

Hi -

I am trying to implement logging for a small application running under Mono on a Raspberry Pi. Unfortunately I have been unable to create an event log despite following guidance that I have found on the Net, and am wondering if there is best practice on how to do this. FWIW, the steps I have taken are as follows:

1.       On the Raspberry Pi, I created /var/lib/mono and /var/lib/mono/eventlog directories, set directory permission on each to 777 per http://lists.ximian.com/pipermail/mono-devel-list/2006-August/019853.html.

2.       Ran the following .NET code, based loosely on http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog(v=vs.110).aspx:

using System;
using System.Text;
using System.Diagnostics;
namespace Logging
    class Program
        static void Main(string[] args)
            if (!EventLog.SourceExists("MySource"))
                EventLog.CreateEventSource("MySource", "MyNewLog");
                Console.WriteLine("Exiting, execute the application a second time to use the source.");
                Console.WriteLine("Found the EventLog Source.");

If I run this twice on a Windows 8 machine, the first time it comes back with "CreatedEventSource", the second time it comes back with "Found the EventLog Source", and the Windows Event Log has a new log entitled MyNewLog. However, if I run it on the Raspberry Pi under mono, I get the message "CreatedEventSource" no matter how many times I run it, and no files are created in /var/lib/mono/eventlog.

What am I missing, or what should I try instead?

Spyros Sakellariadis
Microsoft Open Technologies, Inc.
spyros at microsoft.com<mailto:spyros at microsoft.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20141208/15934ad2/attachment.html>

More information about the Mono-devel-list mailing list