[Mono-list] Nothing happens with mono-service and EventLog.WriteEntry

Michael Schurter michael at susens-schurter.com
Mon Feb 12 11:42:03 EST 2007

Hi all,

I created a service in MonoDevelop, compiled it using the 2.0 profile,
and run it using mono-service.

Everything appears to work fine: Service started and stopped messages
show up in my syslog, the process is running, and the lock file exists.

However my service doesn't seem to do anything, and none of my
EventLog.WriteEntry() calls seem to generate any logging information (I
also tried Console.WriteLine()).

How do I even begin to debug this if I can't get any output from it?

I'm using Mono on Debian Sid.

Here are relevant code snippets.  I'll post the full source if you think
it would help (its not that big).

Thanks in advance!

Michael Schurter

/// Class declaration:
class LumberjackService : System.ServiceProcess.ServiceBase

/// Main method:
public static void Main ()
  System.ServiceProcess.ServiceBase.Run (new LumberjackService ());

/// ctor:
public LumberjackService ()
  this.ServiceName = "Lumberjack";
  this.CanStop = true;
  this.CanPauseAndContinue = false;
  this.AutoLog = true;
  EventLog.WriteEntry("New Lumberjack Service Created");  // Never seen

/// OnStart:
protected override void OnStart (string[] args)
  EventLog.WriteEntry("Lumberjack starting...");
  state = LumberjackState.Run;
  LumberjackThread = new Thread(new ThreadStart (HarvestLog));

...the thread should output stuff to the event log as well and
eventually die because a file doesn't exist.

More information about the Mono-list mailing list