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 1.2.2.1 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));
  LumberjackThread.Start();

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

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to