monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fwd: Bug#353758: monit: suboptimal logging reduces usefulness]


From: Martin Pala
Subject: Re: [Fwd: Bug#353758: monit: suboptimal logging reduces usefulness]
Date: Wed, 26 Apr 2006 14:38:49 +0200
User-agent: Thunderbird 1.5.0.2 (Windows/20060308)

Hi,

here is the patch which implements the logging priority.

It uses standard syslog priorities:
    emergency
    alert
    critical
    error
    warning
    notice
    info
    debug

The priority is generally assigned based on context.

The service failed events are logged with the "error" priority, service passed events are logged with "info" priority.

When explicit log file is used instead of syslog, the priority is logged as part of the message ... example (monit running in debug mode):


[ Apr 19 04:35:02] debug : monit: pidfile '/var/run/monit.pid' does not exist [ Apr 19 04:35:03] info : Starting monit daemon with http interface at [foo:2812]
[ Apr 19 04:35:03] info     : Starting monit HTTP server at [foo:2812]
[ Apr 19 04:35:03] info     : monit HTTP server started
[ Apr 19 04:35:03] info     : Monit started
[ Apr 19 04:35:03] debug : Monit instance changed notification is sent to address@hidden [ Apr 19 04:35:03] debug : 'ntp1' succeeded connecting to INET[ntp1.bar:123] via UDP [ Apr 19 04:35:05] debug : 'ntp1' succeeded testing protocol [NTP3] at INET[ntp1:123] via UDP
[ Apr 19 04:35:10] info     : Monit has not changed
[ Apr 19 04:35:10] debug : 'ntp1' succeeded connecting to INET[ntp1.bar:123] via UDP [ Apr 19 04:35:12] debug : 'ntp1' succeeded testing protocol [NTP3] at INET[ntp1:123] via UDP
[ Apr 19 04:35:14] info     : Shutting down monit HTTP server
[ Apr 19 04:35:14] info     : monit HTTP server stopped
[ Apr 19 04:35:14] info     : monit daemon with pid [1428] killed
[ Apr 19 04:35:14] info     : Monit stopped
[ Apr 19 04:35:14] debug : Monit instance changed notification is sent to address@hidden


Martin




Jan-Henrik Haukeland wrote:
Absolutely interesting. Not sure if I like syslog's severity flags as part of the argument list though, another option could be to create either macros or new function-wrappers around log_log() to have a couple of new functions such as info(), error() and debug() and use them instead of e.g. log(LOG_ERR,..)



On 20. feb. 2006, at 21.17, Martin Pala wrote:

Looks interesting ... what do you think?

We should probably support the event severity. I'm +1 to add it to the monit TODO list (Wouter's help with the implementation could be great :)

Martin


-------- Original Message --------
Subject: Bug#353758: monit: suboptimal logging reduces usefulness
Resent-Date: Mon, 20 Feb 2006 18:04:00 UTC, Mon, 20 Feb 2006 10:04:03 -0800
Resent-From: Wouter Verhelst <address@hidden>
Resent-To: address@hidden
Resent-CC: Stefan Alfredsson <address@hidden>
Date: Mon, 20 Feb 2006 10:59:58 +0100
From: Wouter Verhelst <address@hidden>
Reply-To: Wouter Verhelst <address@hidden>, address@hidden
To: Debian Bug Tracking System <address@hidden>

Package: monit
Version: 1:4.6-1
Severity: important
Tags: patch

Hi,

Monit has the ability to log events to syslog. For a monitoring utility,
this is very useful -- but monit logs everything at level LOG_ERR, so
critical messages about services that failed or were lost are intermixed
with debugging messages about the monit service starting up or even
checking whether something is still running.

I'm currently configuring a cluster where monitoring is done through a
third-party service which has the ability to create events from syslog
messages. To reduce event clutter, however, we want to make sure that
nonimportant messages are not logged as events; the fact that monit logs
everything at the same level isn't very helpful for that.

I'm attaching a quick-and-dirty patch which applies to monit-4.5 as it
is in sarge, and which is the version that I'm currently using on this
cluster. It's ugly, but it does what I needed it to do and was all I
could come up with in the short timeframe that was given for this
project. I know that's not very helpful; however, if upstream is
interested, I'd be happy to help clean it up and provide a more robust
method to differentiate log levels.

All that being said, I question some bits of the code...:

log("%s: Error opening the log file '%s' for writing -- %s\n",
   prog, Run.logfile, STRERROR);

If opening the log file failed, presumably so will writing to it.

log prints to stderr as well..


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15.4
Locale: address@hidden, address@hidden (charmap=UTF-8)

Versions of packages monit depends on:
ii libc6 2.3.6-1 GNU C Library: Shared libraries an
ii  libssl0.9.8                   0.9.8a-7   SSL shared libraries

monit recommends no packages.

-- no debconf information

--Fun will now commence
  -- Seven Of Nine, "Ashes to Ashes", stardate 53679.4

--
Jan-Henrik Haukeland
Mobil +47 97141255



_______________________________________________
monit-dev mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/monit-dev


diff -Naur monit/CHANGES.txt monit-mp/CHANGES.txt
--- monit/CHANGES.txt   2006-04-14 01:45:21.735484000 +0200
+++ monit-mp/CHANGES.txt        2006-04-19 06:20:10.845086000 +0200
@@ -22,6 +22,17 @@
   servers or server-side programs may inappropriately respond with 
   a redirect request if port number is included.
 
+* The message priority support added for the logging output. Standard
+  syslog priorities are used based on the context:
+    emergency
+    alert
+    critical
+    error
+    warning
+    notice
+    info
+    debug
+
 BUGFIXES:
 
 * Fix the presentation of the Leap Indicator field in NTP protocol test.
diff -Naur monit/alert.c monit-mp/alert.c
--- monit/alert.c       2006-04-19 05:34:35.693609000 +0200
+++ monit-mp/alert.c    2006-04-19 05:40:00.685639000 +0200
@@ -86,7 +86,7 @@
 
   s= Event_get_source(E);
   if(!s) {
-    log("Aborting alert\n");
+    LogError("Aborting alert\n");
     return rv;
   }
 
diff -Naur monit/collector.c monit-mp/collector.c
--- monit/collector.c   2006-04-19 05:34:35.768038000 +0200
+++ monit-mp/collector.c        2006-04-19 05:40:00.689324000 +0200
@@ -88,17 +88,17 @@
     socket_create_t(C->url->hostname, C->url->port, SOCKET_TCP, C->ssl, 
C->timeout)
   ))
   {
-    log("Collector: cannot open a connection to %s -- %s\n",
+    LogError("Collector: cannot open a connection to %s -- %s\n",
       C->url->url, STRERROR);
 
     if((C= C->next))
     {
-      log("Collector: trying next server %s\n", C->url->url);
+      LogInfo("Collector: trying next server %s\n", C->url->url);
       continue;
     }
     else
     {
-      log("Collector: no server available\n");
+      LogError("Collector: no server available\n");
       rv = HANDLER_COLLECTOR;
       goto exit2;
     }
@@ -108,13 +108,13 @@
 
   if(!data_send(C, D))
   {
-    log("Collector: communication failure\n");
+    LogError("Collector: communication failure\n");
     rv = HANDLER_COLLECTOR;
     goto exit1;
   }
   if(!data_check(C))
   {
-    log("Collector: communication failure\n");
+    LogError("Collector: communication failure\n");
     rv = HANDLER_COLLECTOR;
     goto exit1;
   }
@@ -168,7 +168,8 @@
   FREE(auth);
   if(rv <0)
   {
-    log("Collector: error sending data to %s -- %s\n", C->url->url, STRERROR);
+    LogError("Collector: error sending data to %s -- %s\n",
+      C->url->url, STRERROR);
     return FALSE;
   }
   return TRUE;
@@ -187,14 +188,15 @@
   char buf[STRLEN];
 
   if(!socket_readln(C->socket, buf, sizeof(buf))) {
-    log("Collector: error receiving data from %s -- %s\n", 
+    LogError("Collector: error receiving data from %s -- %s\n", 
        C->url->url, STRERROR);
     return FALSE;
   }
   Util_chomp(buf);
   n = sscanf(buf, "%*s %d", &status);
   if(n != 1 || (status >= 400)) {
-    log("Collector: message sending failed to %s -- %s\n", C->url->url, buf);
+    LogError("Collector: message sending failed to %s -- %s\n",
+      C->url->url, buf);
     return FALSE;
   }
   return TRUE;
diff -Naur monit/control.c monit-mp/control.c
--- monit/control.c     2006-04-19 05:34:35.892655000 +0200
+++ monit-mp/control.c  2006-04-19 05:40:00.695428000 +0200
@@ -95,7 +95,7 @@
   ASSERT(action);
   
   if(Util_getAction(action) == ACTION_IGNORE) {
-    log("%s: Cannot %s service '%s' -- invalid action %s\n",
+    LogError("%s: Cannot %s service '%s' -- invalid action %s\n",
         prog, action, S, action);
     goto error;
   }
@@ -105,7 +105,7 @@
   
   if(!s) {
     
-    log("%s: Cannot connect to the monit daemon."
+    LogError("%s: Cannot connect to the monit daemon."
         " Did you start it with http support?\n", prog);
     goto error;
     
@@ -113,7 +113,7 @@
     
     if(socket_print(s, "GET /%s?action=%s HTTP/1.0\r\n%s\r\n", 
                     S, action, auth?auth:"") < 0)
-      log("%s: Cannot send the command '%s' to the monit daemon -- %s", 
+      LogError("%s: Cannot send the command '%s' to the monit daemon -- %s", 
           prog, action?action:"null", STRERROR);
     socket_free(&s);
     
@@ -139,7 +139,7 @@
   ASSERT(action);
 
   if(!(s= Util_getService(S))) {
-    log("%s: Cannot %s service '%s' -- not found in %s\n",
+    LogError("%s: Cannot %s service '%s' -- not found in %s\n",
         prog, action, S, Run.controlfile);
     return;
   }
@@ -184,7 +184,7 @@
         Util_monitorSet(s);
         return;
       }
-      log("'%s' trying to restart\n", s->name);
+      LogInfo("'%s' trying to restart\n", s->name);
       do_depend(s, ACTION_STOP);
       if(do_stop(s)) {
         /* Only start if stop succeeded */
@@ -212,7 +212,7 @@
       break;
 
     default:
-      log("%s: Cannot %s service '%s' -- invalid action %s\n",
+      LogError("%s: Cannot %s service '%s' -- invalid action %s\n",
           prog, action, S, action);
       break;
   }
@@ -269,7 +269,7 @@
     int status;
     pthread_t thread;
 
-    log("'%s' start: %s\n", s->name, s->start->arg[0]);
+    LogInfo("'%s' start: %s\n", s->name, s->start->arg[0]);
     spawn(s, s->start, "Started");
     if(s->type==TYPE_PROCESS) {
       /* We only wait for a process type, other service types does not
@@ -282,7 +282,7 @@
         LOCK(Run.mutex)
           Run.wait_start--;
         END_LOCK;
-       log("Warning: Failed to create the start controller thread. "
+       LogError("Warning: Failed to create the start controller thread. "
            "Thread error -- %s.\n", strerror(status));
       }
     }
@@ -313,7 +313,7 @@
   } 
 
   if(s->stop && (s->type!=TYPE_PROCESS || Util_isProcessRunning(s))) {
-    log("'%s' stop: %s\n", s->name, s->stop->arg[0]);
+    LogInfo("'%s' stop: %s\n", s->name, s->stop->arg[0]);
     spawn(s, s->stop, "Stopped");
 
     if(s->type==TYPE_PROCESS) {
diff -Naur monit/daemonize.c monit-mp/daemonize.c
--- monit/daemonize.c   2006-04-19 05:34:35.942370000 +0200
+++ monit-mp/daemonize.c        2006-04-19 05:40:00.699259000 +0200
@@ -92,7 +92,7 @@
    */
   if((pid= fork ()) < 0) {
     
-    log("Cannot fork of a new process\n");  
+    LogError("Cannot fork of a new process\n");  
     exit (1);
     
   }  
@@ -106,7 +106,7 @@
 
   if((pid= fork ()) < 0) {
     
-    log("Cannot fork of a new process\n");  
+    LogError("Cannot fork of a new process\n");  
     exit (1);
     
   }  
@@ -123,7 +123,7 @@
    */
   if(chdir("/") < 0) {
     
-    log("Cannot chdir to / -- %s\n", STRERROR);
+    LogError("Cannot chdir to / -- %s\n", STRERROR);
     exit(1);
     
   }
@@ -150,14 +150,15 @@
     
     if ( kill(pid, sig) < 0 ) {
       
-      log("%s: Cannot send signal to daemon process -- %s\n",prog, STRERROR);
+      LogError("%s: Cannot send signal to daemon process -- %s\n",
+        prog, STRERROR);
       return FALSE;
       
     }
     
   } else {
     
-    log("%s: No daemon process found\n", prog);
+    LogInfo("%s: No daemon process found\n", prog);
     return TRUE;
     
   }
diff -Naur monit/device/device_common.c monit-mp/device/device_common.c
--- monit/device/device_common.c        2006-04-19 05:34:37.488045000 +0200
+++ monit-mp/device/device_common.c     2006-04-19 05:40:00.702438000 +0200
@@ -87,7 +87,7 @@
   ASSERT(object);
 
   if(stat(object, &buf) != 0) {
-    log("%s: Cannot stat '%s' -- %s\n", prog, object, STRERROR);
+    LogError("%s: Cannot stat '%s' -- %s\n", prog, object, STRERROR);
     return NULL;
   }
 
@@ -101,7 +101,8 @@
 
   }
 
-  log("%s: Not file, directory or block special device: '%s'", prog, object);
+  LogError("%s: Not file, directory or block special device: '%s'",
+    prog, object);
 
   return NULL;
 
diff -Naur monit/device/sysdep_AIX.c monit-mp/device/sysdep_AIX.c
--- monit/device/sysdep_AIX.c   2006-04-19 05:34:37.503445000 +0200
+++ monit-mp/device/sysdep_AIX.c        2006-04-19 05:40:00.705532000 +0200
@@ -42,7 +42,7 @@
  */
 char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
 
-  log("%s: Unsupported mounted filesystem information method", prog);
+  LogError("%s: Unsupported mounted filesystem information method", prog);
 
   return NULL;
 
@@ -57,7 +57,7 @@
  */
 int device_usage_sysdep(Info_T inf) {
 
-  log("%s: Unsupported filesystem informations gathering method\n", prog);
+  LogError("%s: Unsupported filesystem informations gathering method\n", prog);
 
   return FALSE;
 
diff -Naur monit/device/sysdep_DARWIN.c monit-mp/device/sysdep_DARWIN.c
--- monit/device/sysdep_DARWIN.c        2006-04-19 05:34:37.506073000 +0200
+++ monit-mp/device/sysdep_DARWIN.c     2006-04-19 05:40:00.708480000 +0200
@@ -70,7 +70,7 @@
   ASSERT(blockdev);
 
   if(statfs(blockdev, &usage) != 0) {
-    log("%s: Error getting mountpoint for device '%s' -- %s\n",
+    LogError("%s: Error getting mountpoint for device '%s' -- %s\n",
         prog, blockdev, STRERROR);
     return NULL;
   }
@@ -94,7 +94,7 @@
   ASSERT(inf);
 
   if(statfs(inf->mntpath, &usage) != 0) {
-    log("%s: Error getting usage statistics for device '%s' -- %s\n",
+    LogError("%s: Error getting usage statistics for device '%s' -- %s\n",
         prog, inf->mntpath, STRERROR);
     return FALSE;
   }
diff -Naur monit/device/sysdep_FREEBSD.c monit-mp/device/sysdep_FREEBSD.c
--- monit/device/sysdep_FREEBSD.c       2006-04-19 05:34:37.508227000 +0200
+++ monit-mp/device/sysdep_FREEBSD.c    2006-04-19 05:40:00.712041000 +0200
@@ -70,7 +70,7 @@
   ASSERT(blockdev);
 
   if(statfs(blockdev, &usage) != 0) {
-    log("%s: Error getting mountpoint for device '%s' -- %s\n",
+    LogError("%s: Error getting mountpoint for device '%s' -- %s\n",
         prog, blockdev, STRERROR);
     return NULL;
   }
@@ -94,7 +94,7 @@
   ASSERT(inf);
 
   if(statfs(inf->mntpath, &usage) != 0) {
-    log("%s: Error getting usage statistics for device '%s' -- %s\n",
+    LogError("%s: Error getting usage statistics for device '%s' -- %s\n",
         prog, inf->mntpath, STRERROR);
     return FALSE;
   }
diff -Naur monit/device/sysdep_HPUX.c monit-mp/device/sysdep_HPUX.c
--- monit/device/sysdep_HPUX.c  2006-04-19 05:34:37.511073000 +0200
+++ monit-mp/device/sysdep_HPUX.c       2006-04-19 05:40:00.715043000 +0200
@@ -77,7 +77,7 @@
 
 
   if((mntfd= setmntent("/etc/mnttab", "r")) == NULL) {
-    log("%s: Cannot open /etc/mnttab file", prog);
+    LogError("%s: Cannot open /etc/mnttab file", prog);
     return NULL;
   }
 
@@ -114,7 +114,7 @@
   ASSERT(inf);
 
   if(statfsdev(inf->mntpath, &usage) != 0) {
-    log("%s: Error getting usage statistics for device '%s' -- %s\n",
+    LogError("%s: Error getting usage statistics for device '%s' -- %s\n",
         prog, inf->mntpath, STRERROR);
     return FALSE;
   }
diff -Naur monit/device/sysdep_LINUX.c monit-mp/device/sysdep_LINUX.c
--- monit/device/sysdep_LINUX.c 2006-04-19 05:34:37.514196000 +0200
+++ monit-mp/device/sysdep_LINUX.c      2006-04-19 05:40:00.717946000 +0200
@@ -77,7 +77,7 @@
 
 
   if((mntfd= setmntent("/etc/mtab", "r")) == NULL) {
-    log("%s: Cannot open /etc/mtab file", prog);
+    LogError("%s: Cannot open /etc/mtab file", prog);
     return NULL;
   }
 
@@ -114,7 +114,7 @@
   ASSERT(inf);
 
   if(statfs(inf->mntpath, &usage) != 0) {
-    log("%s: Error getting usage statistics for device '%s' -- %s\n",
+    LogError("%s: Error getting usage statistics for device '%s' -- %s\n",
         prog, inf->mntpath, STRERROR);
     return FALSE;
   }
diff -Naur monit/device/sysdep_NETBSD.c monit-mp/device/sysdep_NETBSD.c
--- monit/device/sysdep_NETBSD.c        2006-04-19 05:34:37.589762000 +0200
+++ monit-mp/device/sysdep_NETBSD.c     2006-04-19 05:40:00.721275000 +0200
@@ -69,7 +69,7 @@
   ASSERT(blockdev);
 
   if(statfs(blockdev, &usage) != 0) {
-    log("%s: Error getting mountpoint for device '%s' -- %s\n",
+    LogError("%s: Error getting mountpoint for device '%s' -- %s\n",
         prog, blockdev, STRERROR);
     return NULL;
   }
@@ -93,7 +93,7 @@
   ASSERT(inf);
 
   if(statfs(inf->mntpath, &usage) != 0) {
-    log("%s: Error getting usage statistics for device '%s' -- %s\n",
+    LogError("%s: Error getting usage statistics for device '%s' -- %s\n",
         prog, inf->mntpath, STRERROR);
     return FALSE;
   }
diff -Naur monit/device/sysdep_OPENBSD.c monit-mp/device/sysdep_OPENBSD.c
--- monit/device/sysdep_OPENBSD.c       2006-04-19 05:34:37.592366000 +0200
+++ monit-mp/device/sysdep_OPENBSD.c    2006-04-19 05:40:00.724220000 +0200
@@ -70,7 +70,7 @@
   ASSERT(blockdev);
 
   if(statfs(blockdev, &usage) != 0) {
-    log("%s: Error getting mountpoint for device '%s' -- %s\n",
+    LogError("%s: Error getting mountpoint for device '%s' -- %s\n",
         prog, blockdev, STRERROR);
     return NULL;
   }
@@ -94,7 +94,7 @@
   ASSERT(inf);
 
   if(statfs(inf->mntpath, &usage) != 0) {
-    log("%s: Error getting usage statistics for device '%s' -- %s\n",
+    LogError("%s: Error getting usage statistics for device '%s' -- %s\n",
         prog, inf->mntpath, STRERROR);
     return FALSE;
   }
diff -Naur monit/device/sysdep_SOLARIS.c monit-mp/device/sysdep_SOLARIS.c
--- monit/device/sysdep_SOLARIS.c       2006-04-19 05:34:37.595130000 +0200
+++ monit-mp/device/sysdep_SOLARIS.c    2006-04-19 05:40:00.727133000 +0200
@@ -77,7 +77,7 @@
 
 
   if((mntfd= fopen("/etc/mnttab", "r")) == NULL) {
-    log("%s: Cannot open /etc/mnttab file", prog);
+    LogError("%s: Cannot open /etc/mnttab file", prog);
     return NULL;
   }
 
@@ -114,7 +114,7 @@
   ASSERT(inf);
 
   if(statvfs(inf->mntpath, &usage) != 0) {
-    log("%s: Error getting usage statistics for device '%s' -- %s\n",
+    LogError("%s: Error getting usage statistics for device '%s' -- %s\n",
         prog, inf->mntpath, STRERROR);
     return FALSE;
   }
diff -Naur monit/device/sysdep_UNKNOWN.c monit-mp/device/sysdep_UNKNOWN.c
--- monit/device/sysdep_UNKNOWN.c       2006-04-19 05:34:37.598072000 +0200
+++ monit-mp/device/sysdep_UNKNOWN.c    2006-04-19 05:40:00.729984000 +0200
@@ -42,7 +42,7 @@
  */
 char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
 
-  log("%s: Unsupported mounted filesystem information method", prog);
+  LogError("%s: Unsupported mounted filesystem information method", prog);
 
   return NULL;
 
@@ -57,7 +57,8 @@
  */
 int device_usage_sysdep(Info_T inf) {
 
-  log("%s: Unsupported filesystem informations gathering method\n", prog);
+  LogError("%s: Unsupported filesystem informations gathering method\n",
+    prog);
 
   return FALSE;
 
diff -Naur monit/env.c monit-mp/env.c
--- monit/env.c 2006-04-19 05:34:36.032514000 +0200
+++ monit-mp/env.c      2006-04-19 05:40:00.733758000 +0200
@@ -148,7 +148,7 @@
   
   if(putenv(path)) {
     
-    log("%s: cannot set the PATH variable -- %s\n", prog, STRERROR);
+    LogError("%s: cannot set the PATH variable -- %s\n", prog, STRERROR);
     exit(1);
     
   }
@@ -161,7 +161,7 @@
     
     if(fstat(i, &st) == -1 && open("/dev/null", O_RDWR) != i) {
       
-      log("Cannot open /dev/null -- %s\n", STRERROR);
+      LogError("Cannot open /dev/null -- %s\n", STRERROR);
       exit(1);
       
     }
@@ -184,7 +184,7 @@
   /* Get password struct */
   if ( ! (pw= getpwuid(geteuid())) ) {
     
-    log("%s: You don't exist. Go away.\n", prog);
+    LogError("%s: You don't exist. Go away.\n", prog);
     exit(1);
     
   }
@@ -192,7 +192,8 @@
   /* Get CWD */
   if ( ! (getcwd(cwd, sizeof(cwd))) ) {
     
-    log("%s: Cannot read current directory -- %s\n", prog, STRERROR);
+    LogError("%s: Cannot read current directory -- %s\n",
+      prog, STRERROR);
     exit(1);
     
   }
diff -Naur monit/event.c monit-mp/event.c
--- monit/event.c       2006-04-19 05:34:36.187193000 +0200
+++ monit-mp/event.c    2006-04-19 06:10:02.676607000 +0200
@@ -257,7 +257,7 @@
 
   if(!(s = Util_getService(E->source)))
   {
-    log("Service %s not found in monit configuration\n", E->source);
+    LogError("Service %s not found in monit configuration\n", E->source);
   }
 
   return s;
@@ -513,7 +513,7 @@
   if(! (dir = opendir(Run.eventlist_dir)) )
   {
     if(errno != ENOENT) {
-      log("%s: cannot open the directory %s -- %s\n",
+      LogError("%s: cannot open the directory %s -- %s\n",
         prog, Run.eventlist_dir, STRERROR);
     }
     return;
@@ -562,7 +562,7 @@
 
       if(! (file = fopen(file_name, "r")) )
       {
-        log("%s: Processing failed - cannot open the event file %s -- %s\n",
+        LogError("%s: Processing failed - cannot open the event file %s -- 
%s\n",
           prog, file_name, STRERROR);
         goto error;
       }
@@ -572,7 +572,7 @@
         goto error;
       if(*version != EVENT_VERSION)
       {
-        log("Aborting event %s - incompatible data format version %d\n",
+        LogError("Aborting event %s - incompatible data format version %d\n",
           file_name, *version);
         unlink(file_name);
         goto error;
@@ -626,7 +626,7 @@
           }
           else
           {
-            log("Alert handler failed, retry scheduled for next cycle\n");
+            LogError("Alert handler failed, retry scheduled for next cycle\n");
             Run.handler_flag |= HANDLER_ALERT;
           }
         }
@@ -648,7 +648,7 @@
           }
           else
           {
-            log("Collector handler failed, retry scheduled for next cycle\n");
+            LogError("Collector handler failed, retry scheduled for next 
cycle\n");
             Run.handler_flag |= HANDLER_COLLECTOR;
           }
         }
@@ -712,7 +712,11 @@
      * logged. */
     if(E->state != STATE_INIT || E->state_map & 0x1)
     {
-      log("%s\n", E->message);
+      if(E->id == EVENT_INSTANCE || E->state == STATE_PASSED) {
+        LogInfo("%s\n", E->message);
+      } else {
+        LogError("%s\n", E->message);
+      }
     }
     if(E->state == STATE_INIT)
     {
@@ -723,7 +727,7 @@
   S = Event_get_source(E);
   if(!S)
   {
-    log("Event handling aborted\n");
+    LogError("Event handling aborted\n");
     return;
   }
 
@@ -772,14 +776,14 @@
     }
     else
     {
-      log("Aborting event\n");
+      LogError("Aborting event\n");
     }
   }
 
   s = Event_get_source(E);
   if(!s)
   {
-    log("Event action handling aborted\n");
+    LogError("Event action handling aborted\n");
     return FALSE;
   }
 
@@ -823,7 +827,7 @@
       return FALSE;
 
   default:
-      log("'%s' error -- unknown failure action: [%d]\n", s->name,
+      LogError("'%s' error -- unknown failure action: [%d]\n", s->name,
         A->id);
       break;
 
@@ -853,14 +857,14 @@
 
   if(!File_checkQueueDirectory(Run.eventlist_dir, 0700))
   {
-    log("%s: Aborting event - cannot access the directory %s\n",
+    LogError("%s: Aborting event - cannot access the directory %s\n",
       prog, Run.eventlist_dir);
     return;
   }
     
   if(!File_checkQueueLimit(Run.eventlist_dir, Run.eventlist_slots))
   {
-    log("%s: Aborting event - queue over quota\n", prog);
+    LogError("%s: Aborting event - queue over quota\n", prog);
     return;
   }
     
@@ -879,7 +883,7 @@
   umask(mask);
   if(! file)
   {
-    log("%s: Aborting event - cannot open the event file %s -- %s\n",
+    LogError("%s: Aborting event - cannot open the event file %s -- %s\n",
       prog, file_name, STRERROR);
     return;
   }
@@ -911,7 +915,7 @@
   error:
   if(!rv)
   {
-    log("%s: Aborting event - unable to save event information to %s\n",
+    LogError("%s: Aborting event - unable to save event information to %s\n",
       prog, file_name);
     unlink(file_name);
   }
diff -Naur monit/file.c monit-mp/file.c
--- monit/file.c        2006-04-19 05:34:36.304737000 +0200
+++ monit-mp/file.c     2006-04-19 05:40:00.759778000 +0200
@@ -134,7 +134,7 @@
        ) {
       return MAX(buf.st_mtime, buf.st_ctime);
     } else {
-      log("%s: Invalid object type - %s\n", prog, object);
+      LogError("%s: Invalid object type - %s\n", prog, object);
     }
   }
 
@@ -173,7 +173,7 @@
     snprintf(rcfile, STRLEN, "%s/%s", Run.Env.cwd, MONITRC);
     return (rcfile);
   }
-  log("%s: Cannot find the control file at "
+  LogError("%s: Cannot find the control file at "
       "~/.%s, /etc/%s, /usr/local/etc/%s or at ./%s \n",
       prog, MONITRC, MONITRC, MONITRC, MONITRC);
   exit(1);
@@ -196,7 +196,7 @@
   umask(MYPIDMASK);
   unlink(pidfile);
   if ((F= fopen(pidfile,"w")) == (FILE *)NULL) {
-    log("%s: Error opening pidfile '%s' for writing -- %s\n",
+    LogError("%s: Error opening pidfile '%s' for writing -- %s\n",
        prog, pidfile, STRERROR);
     return(FALSE);
   }
@@ -292,22 +292,22 @@
   ASSERT(description);
 
   if(lstat(filename, &buf) < 0) {
-    log("%s: Cannot stat the %s '%s' -- %s\n",
+    LogError("%s: Cannot stat the %s '%s' -- %s\n",
        prog, description, filename, STRERROR);
     return FALSE;
   }
   if(S_ISLNK(buf.st_mode)) {
-    log("%s: The %s '%s' must not be a symbolic link.\n",
+    LogError("%s: The %s '%s' must not be a symbolic link.\n",
        prog, description, filename);
     return(FALSE);
   }
   if(!S_ISREG(buf.st_mode)) {
-    log("%s: The %s '%s' is not a regular file.\n", 
+    LogError("%s: The %s '%s' is not a regular file.\n", 
        prog, description,  filename);
     return FALSE;
   }
   if(buf.st_uid != geteuid())  {
-    log("%s: The %s '%s' must be owned by you.\n", 
+    LogError("%s: The %s '%s' must be owned by you.\n", 
        prog, description, filename);
     return FALSE;
   }
@@ -321,7 +321,7 @@
            () & ~permmask ->      We check if there are any other
                                   permissions set than in permmask 
     */
-    log("%s: The %s '%s' must have permissions no more "
+    LogError("%s: The %s '%s' must have permissions no more "
        "than -%c%c%c%c%c%c%c%c%c (0%o); "
        "right now permissions are -%c%c%c%c%c%c%c%c%c (0%o).\n", 
        prog, description, filename, 
@@ -371,15 +371,17 @@
       rv = mkdir(path, mode);
       umask(mask);
       if(rv) {
-        log("%s: cannot create the directory %s -- %s\n", prog, path, 
STRERROR);
+        LogError("%s: cannot create the directory %s -- %s\n",
+          prog, path, STRERROR);
         return FALSE;
       }
     } else {
-      log("%s: cannot read the directory %s -- %s\n", prog, path, STRERROR);
+      LogError("%s: cannot read the directory %s -- %s\n",
+        prog, path, STRERROR);
       return FALSE;
     }
   } else if(! S_ISDIR(st.st_mode)) {
-    log("%s: the %s is not the directory\n", prog, path);
+    LogError("%s: the %s is not the directory\n", prog, path);
     return FALSE;
   }
   return TRUE;
@@ -399,19 +401,19 @@
   struct dirent *de = NULL;
 
   if(limit <= 0) {
-    log("%s: event queue full\n", prog);
+    LogError("%s: event queue full\n", prog);
     return FALSE;
   }
 
   if(! (dir = opendir(path)) ) {
-    log("%s: cannot open the directory %s -- %s\n", prog, path, STRERROR);
+    LogError("%s: cannot open the directory %s -- %s\n", prog, path, STRERROR);
     return FALSE;
   }
   while( (de = readdir(dir)) ) {
     struct stat st;
 
     if(!stat(de->d_name, &st) && S_ISREG(st.st_mode) && ++used > limit) {
-      log("%s: event queue full\n", prog);
+      LogError("%s: event queue full\n", prog);
       closedir(dir);
       return FALSE;
     }
@@ -444,7 +446,7 @@
   return TRUE;
 
   error:
-  log("%s: unable to write data to the file\n", prog);
+  LogError("%s: unable to write data to the file\n", prog);
   return FALSE;
 }
 
@@ -477,7 +479,7 @@
   return data;
 
   error:
-  log("%s: unable to read data from the file\n", prog);
+  LogError("%s: unable to read data from the file\n", prog);
   return FALSE;
 }
 
diff -Naur monit/http/engine.c monit-mp/http/engine.c
--- monit/http/engine.c 2006-04-19 05:34:37.610774000 +0200
+++ monit-mp/http/engine.c      2006-04-19 05:40:00.765234000 +0200
@@ -155,10 +155,10 @@
 
   if((myServerSocket= create_server_socket(port, backlog, bindAddr)) < 0) {
     
-    log("http server: Could not create a server socket at port %d -- %s\n",
+    LogError("http server: Could not create a server socket at port %d -- 
%s\n",
        port, STRERROR);
     
-    log("monit HTTP server not available\n");
+    LogError("monit HTTP server not available\n");
     
     if(Run.init) {
       
@@ -178,9 +178,9 @@
       
       if(mySSLServerConnection == NULL) {
        
-       log("http server: Could not initialize SSL engine\n");
+       LogError("http server: Could not initialize SSL engine\n");
        
-       log("monit HTTP server not available\n");
+       LogError("monit HTTP server not available\n");
        
        return;
       }
@@ -236,7 +236,7 @@
 
   if(! (hp= gethostbyname(name))) {
     
-    log("%s: Error: hostname did not resolve '%s'.\n",
+    LogError("%s: Error: hostname did not resolve '%s'.\n",
           prog, name); 
     return FALSE;
     
@@ -422,7 +422,7 @@
 
   if((Impl.doGet == 0) || (Impl.doPost == 0)) {
     
-    log("http server: Service Methods not implemented\n");
+    LogError("http server: Service Methods not implemented\n");
     _exit(1);
     
   }
@@ -449,7 +449,7 @@
 
   }
 
-  log("%s: Denied connection from non-authorized client [%s]\n", prog,
+  LogError("%s: Denied connection from non-authorized client [%s]\n", prog,
       inet_ntoa(addr));
   
   return FALSE;
@@ -649,9 +649,9 @@
     if( (client= accept(server, (struct sockaddr*)&in, &len)) < 0) {
 
       if(stopped) {
-        log("http server: service stopped\n");
+        LogError("http server: service stopped\n");
       }  else {
-        log("http server: cannot accept connection -- %s\n", STRERROR);
+        LogError("http server: cannot accept connection -- %s\n", STRERROR);
       }
 
       return NULL;
diff -Naur monit/http/processor.c monit-mp/http/processor.c
--- monit/http/processor.c      2006-04-19 05:34:37.719870000 +0200
+++ monit-mp/http/processor.c   2006-04-19 05:40:00.770274000 +0200
@@ -781,13 +781,13 @@
   }
   /* Check if user exist */
   if(NULL==Util_getUserCredentials(uname)) {
-    log("Warning: Client '%s' supplied unknown user '%s'"
+    LogError("Warning: Client '%s' supplied unknown user '%s'"
        " accessing monit httpd\n", socket_get_remote_host(req->S), uname); 
     return FALSE;
   }
   /* Check if user has supplied the right password */
   if(! Util_checkCredentials(uname,  password)) {
-    log("Warning: Client '%s' supplied wrong password for user '%s'"
+    LogError("Warning: Client '%s' supplied wrong password for user '%s'"
        " accessing monit httpd\n", socket_get_remote_host(req->S), uname); 
     return FALSE;
   }
diff -Naur monit/http.c monit-mp/http.c
--- monit/http.c        2006-04-19 05:34:36.354689000 +0200
+++ monit-mp/http.c     2006-04-19 05:40:00.774230000 +0200
@@ -88,7 +88,7 @@
     
     if(! has_hosts_allow() && ! Run.credentials) {
       
-      log("%s: monit httpd not started since no connect allowed\n",
+      LogError("%s: monit httpd not started since no connect allowed\n",
          prog);
       
       return FALSE;
@@ -115,29 +115,29 @@
   switch(action) {
     
   case STOP_HTTP:
-    log("Shutting down %s HTTP server\n", prog);
+    LogInfo("Shutting down %s HTTP server\n", prog);
     stop_httpd();
     if( (status= pthread_join(thread, NULL)) != 0) {
-      log("%s: Failed to stop the http server. Thread error -- %s.\n",
+      LogError("%s: Failed to stop the http server. Thread error -- %s.\n",
           prog, strerror(status));
     } else {
-      log("%s HTTP server stopped\n", prog);
+      LogInfo("%s HTTP server stopped\n", prog);
     }
     break;
 
   case START_HTTP:
-    log("Starting %s HTTP server at [%s:%d]\n",
+    LogInfo("Starting %s HTTP server at [%s:%d]\n",
         prog, Run.bind_addr?Run.bind_addr:"*", Run.httpdport);
     if( (status= pthread_create(&thread, NULL, thread_wrapper, NULL)) != 0) {
-      log("%s: Failed to create the http server. Thread error -- %s.\n",
+      LogError("%s: Failed to create the http server. Thread error -- %s.\n",
           prog, strerror(status));
     } else {
-      log("%s HTTP server started\n", prog);
+      LogInfo("%s HTTP server started\n", prog);
     }
     break;
 
   default:
-    log("%s: Unknown http server action\n", prog);
+    LogError("%s: Unknown http server action\n", prog);
     break;
       
   }
diff -Naur monit/log.c monit-mp/log.c
--- monit/log.c 2006-04-19 05:34:36.357503000 +0200
+++ monit-mp/log.c      2006-04-19 05:40:00.778629000 +0200
@@ -93,11 +93,28 @@
 static pthread_mutex_t log_mutex= PTHREAD_MUTEX_INITIALIZER;
 
 
+static struct mylogpriority {
+  int  priority;
+  char *description;
+} logPriority[]= {
+  {LOG_EMERG,   "emergency"},
+  {LOG_ALERT,   "alert"},
+  {LOG_CRIT,    "critical"},
+  {LOG_ERR,     "error"},
+  {LOG_WARNING, "warning"},
+  {LOG_NOTICE,  "notice"},
+  {LOG_INFO,    "info"},
+  {LOG_DEBUG,   "debug"},
+  {-1,          NULL}
+};
+
+
 /* -------------------------------------------------------------- Prototypes */
 
 
 static int  open_log();
 static char *timefmt(char *t, int size);
+static const char *logPriorityDescription(int p);
 
 
 /* ------------------------------------------------------------------ Public */
@@ -128,9 +145,10 @@
 
 /**
  * Log a message to monits logfile or syslog. 
+ * @param priority A message priority
  * @param s A formated (printf-style) string to log
  */
-void log_log(const char *s, ...) {
+void log_log(int priority, const char *s, ...) {
   
   long len;
   va_list ap;
@@ -147,12 +165,15 @@
 
   if(Run.use_syslog) {
     LOCK(log_mutex)
-      syslog(LOG_ERR, "%s", msg);
+      syslog(priority, "%s", msg);
     END_LOCK;
     
   } else if(LOG) {
     LOCK(log_mutex)
-      fprintf(LOG,"[%s] %s", timefmt(datetime, STRLEN), msg);
+      fprintf(LOG,"[%s] %-8s : %s",
+        timefmt(datetime, STRLEN),
+        logPriorityDescription(priority),
+        msg);
     END_LOCK;
     
   }
@@ -178,7 +199,7 @@
   }
   
   if(LOG  && (0 != fclose(LOG))) {
-    log("%s: Error closing the log file -- %s\n",
+    LogError("%s: Error closing the log file -- %s\n",
        prog, STRERROR);
   }
   pthread_mutex_destroy(&log_mutex);
@@ -200,7 +221,7 @@
   } else {
     umask(LOGMASK);
     if((LOG= fopen(Run.logfile,"a+")) == (FILE *)NULL) {
-      log("%s: Error opening the log file '%s' for writing -- %s\n",
+      LogError("%s: Error opening the log file '%s' for writing -- %s\n",
          prog, Run.logfile, STRERROR);
       return(FALSE);
     }
@@ -232,5 +253,26 @@
 }
 
 
-  
+/**
+ * Get a textual description of the actual log priority.
+ * @param p The log priority
+ * @return A string describing the log priority in clear text. If the
+ * priority is not found NULL is returned.
+ */
+static const char *logPriorityDescription(int p) {
+
+  struct mylogpriority *lp= logPriority;
+
+  while((*lp).description)
+  {
+    if(p == (*lp).priority)
+    {
+      return (*lp).description;
+    }
+    lp++;
+  }
+
+  return NULL;
+
+}
 
diff -Naur monit/monit.pod monit-mp/monit.pod
--- monit/monit.pod     2006-04-05 02:11:15.358701000 +0200
+++ monit-mp/monit.pod  2006-04-19 06:24:56.235900000 +0200
@@ -288,7 +288,8 @@
 /var/log/monit.log>. If B<syslog> is given as a value for the
 I<-l> command-line switch (or the keyword I<set logfile syslog>
 is found in the control file) monit will use the B<syslog> system
-daemon to log messages. To turn off logging, simply do not set
+daemon to log messages. The priority is assigned to each message
+based on the context. To turn off logging, simply do not set
 the logfile in the control file (and of course, do not use the -l
 switch)
 
diff -Naur monit/monitor.c monit-mp/monitor.c
--- monit/monitor.c     2006-04-19 05:34:36.433993000 +0200
+++ monit-mp/monitor.c  2006-04-19 05:40:00.786101000 +0200
@@ -135,7 +135,7 @@
   if((pid= exist_daemon()) > 0) {
     
     kill(pid, SIGUSR1);
-    log("%s daemon at %d awakened\n", prog, pid);
+    LogInfo("%s daemon at %d awakened\n", prog, pid);
     
     return TRUE;
     
@@ -199,7 +199,8 @@
    */
   status= pthread_mutex_init(&Run.mutex, NULL);
   if(status != 0) {
-    log("%s: Cannot initialize mutex -- %s\n", prog, strerror(status));
+    LogError("%s: Cannot initialize mutex -- %s\n",
+      prog, strerror(status));
     exit(1);
   }
 
@@ -235,7 +236,7 @@
    */
   if(Run.testing) {
 
-    log("Control file syntax OK\n");
+    LogInfo("Control file syntax OK\n");
     exit(0);
 
   }
@@ -254,7 +255,7 @@
    */
   if(! servicelist) {
     
-    log("%s: No services has been specified\n", prog);
+    LogError("%s: No services has been specified\n", prog);
     exit(0);
     
   }
@@ -285,8 +286,9 @@
 
   Run.doreload= FALSE;
   
-  log("Awakened by the SIGHUP signal\n");
-  log("Reinitializing %s - Control file '%s'\n", prog, Run.controlfile);
+  LogInfo("Awakened by the SIGHUP signal\n");
+  LogInfo("Reinitializing %s - Control file '%s'\n",
+    prog, Run.controlfile);
   
   /* Stop http interface */
   if(Run.dohttpd)
@@ -300,7 +302,7 @@
   gc();
 
   if(! parse(Run.controlfile)) {
-    log("%s daemon died\n", prog);
+    LogError("%s daemon died\n", prog);
     exit(1);
   }
 
@@ -313,7 +315,7 @@
 
   /* Did we find any services ?  */
   if(! servicelist) {
-    log("%s: No services has been specified\n", prog);
+    LogError("%s: No services has been specified\n", prog);
     exit(0);
   }
   
@@ -321,7 +323,7 @@
   File_init();
 
   if(! File_createPidFile(Run.pidfile)) {
-    log("%s daemon died\n", prog);
+    LogError("%s daemon died\n", prog);
     exit(1);
   }
 
@@ -379,12 +381,13 @@
 
       }
     } else {
-      log("%s: please specify the configured service name or 'all' after %s\n",
+      LogError("%s: please specify the configured service "
+        "name or 'all' after %s\n",
         prog, action);
       exit(1);
     }
   } else if(IS(action, "reload")) {
-    log("Reinitializing monit daemon\n", prog);
+    LogInfo("Reinitializing monit daemon\n", prog);
     kill_daemon(SIGHUP);
   } else if(IS(action, "status")) {
     status(LEVEL_NAME_FULL);
@@ -395,7 +398,8 @@
   } else if(IS(action, "validate")) {
     validate();
   } else {
-    log("%s: invalid argument -- %s  (-h will show valid arguments)\n",
+    LogError("%s: invalid argument -- %s  (-h will show "
+        "valid arguments)\n",
         prog, action);
     exit(1);
   }
@@ -419,7 +423,7 @@
     if(Run.dohttpd)
       monit_http(STOP_HTTP);
 
-    log("%s daemon with pid [%d] killed\n", prog, (int)getpid());
+    LogInfo("%s daemon with pid [%d] killed\n", prog, (int)getpid());
 
     /* send the monit stop notification */
     Event_post(Run.system, EVENT_INSTANCE, STATE_FAILED,
@@ -453,16 +457,16 @@
     Run.once= FALSE;
 
     if(can_http())
-      log("Starting %s daemon with http interface at [%s:%d]\n",
+      LogInfo("Starting %s daemon with http interface at [%s:%d]\n",
           prog, Run.bind_addr?Run.bind_addr:"*", Run.httpdport);
     else
-      log("Starting %s daemon\n", prog);
+      LogInfo("Starting %s daemon\n", prog);
     
     if(Run.init != TRUE)
       daemonize(); 
     
     if(! File_createPidFile(Run.pidfile)) {
-      log("%s daemon died\n", prog);
+      LogError("%s daemon died\n", prog);
       exit(1);
     }
 
@@ -486,7 +490,7 @@
 
       if(Run.dowakeup) {
         Run.dowakeup = FALSE;
-        log("Awakened by User defined signal 1\n");
+        LogInfo("Awakened by User defined signal 1\n");
       }
       
       if(Run.stopped) {
@@ -533,7 +537,7 @@
        Run.isdaemon= TRUE;
        sscanf(optarg, "%d", &Run.polltime);
        if(Run.polltime<1) {
-         log("%s: option -%c requires a natural number\n", prog, opt);
+         LogError("%s: option -%c requires a natural number\n", prog, opt);
          exit(1);
        }
        break;
@@ -598,10 +602,10 @@
        case 'l':
        case 'p':
        case 's':
-           log("%s: option -- %c requires an argument\n", prog, optopt);
+           LogError("%s: option -- %c requires an argument\n", prog, optopt);
            break;
        default:
-           log("%s: invalid option -- %c  (-h will show valid options)\n",
+           LogError("%s: invalid option -- %c  (-h will show valid options)\n",
                  prog, optopt);
            
        }
diff -Naur monit/monitor.h monit-mp/monitor.h
--- monit/monitor.h     2006-04-19 05:34:36.559022000 +0200
+++ monit-mp/monitor.h  2006-04-19 05:40:00.793107000 +0200
@@ -56,6 +56,10 @@
 #endif
 
 #ifdef HAVE_ERRNO_H
+#include <syslog.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
 
@@ -183,9 +187,16 @@
 /** ------------------------------------------------- Special purpose macros */
 
 
-/* Mask compiler built-in namespace (C99) and reserved identifiers as
- *  well as external identifiers (in libraries we link with). */
-#define log  log_log
+/* Logging priority encapsulation */
+#define LogEmergency(...) log_log (LOG_EMERG, __VA_ARGS__)
+#define LogAlert(...)     log_log (LOG_ALERT, __VA_ARGS__)
+#define LogCritical(...)  log_log (LOG_CRIT, __VA_ARGS__)
+#define LogError(...)     log_log (LOG_ERR, __VA_ARGS__)
+#define LogWarning(...)   log_log (LOG_WARNING, __VA_ARGS__)
+#define LogNotice(...)    log_log (LOG_NOTICE, __VA_ARGS__)
+#define LogInfo(...)      log_log (LOG_INFO, __VA_ARGS__)
+#define LogDebug(...)     log_log (LOG_DEBUG, __VA_ARGS__)
+
 
 /* Replace the standard signal function with a more reliable using
  * sigaction. Taken from Stevens APUE book. */
@@ -204,7 +215,7 @@
 #undef MIN
 #define MIN(x,y) ((x) < (y) ? (x) : (y))
 #define IS(a,b)  ((a&&b)?!strcasecmp(a, b):0)
-#define DEBUG if(Run.debug) log
+#define DEBUG if(Run.debug) LogDebug
 #define FLAG(x, y) (x & y) == y 
 #define NVLSTR(x) (x?x:"")
 
@@ -227,7 +238,7 @@
 /** ------------------------------------------ Simple Assert Exception macro */
 
 
-#define ASSERT(e) if(!(e)) { log("AssertException: at %s:%d\naborting..\n", \
+#define ASSERT(e) if(!(e)) { LogCritical("AssertException: at 
%s:%d\naborting..\n", \
     __FILE__, __LINE__); abort(); }
 
 
@@ -795,7 +806,7 @@
 void  spawn(Service_T, Command_T, const char *);
 int   status(char *);
 int   log_init() ;
-void  log_log(const char *, ...) ;
+void  log_log(int, const char *, ...) ;
 void  log_close();
 void  validate() ;
 void  daemonize() ;
diff -Naur monit/p.y monit-mp/p.y
--- monit/p.y   2006-04-19 05:34:36.930288000 +0200
+++ monit-mp/p.y        2006-04-19 05:40:00.806713000 +0200
@@ -1527,7 +1527,7 @@
   msg= Util_formatString(s, ap, &len);
   va_end(ap);
   
-  log("%s:%i: Error: %s '%s'\n", currentfile, lineno, msg, yytext);
+  LogError("%s:%i: Error: %s '%s'\n", currentfile, lineno, msg, yytext);
   cfg_errflag++;
  
   FREE(msg);
@@ -1549,7 +1549,7 @@
   msg= Util_formatString(s, ap, &len);
   va_end(ap);
   
-  log("%s:%i: Warning: %s '%s'\n", currentfile, lineno, msg, yytext);
+  LogWarning("%s:%i: Warning: %s '%s'\n", currentfile, lineno, msg, yytext);
  
   FREE(msg);
   
@@ -1570,7 +1570,7 @@
   msg= Util_formatString(s, ap, &len);
   va_end(ap);
   
-  log("%s:%i: Error: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
+  LogError("%s:%i: Error: %s '%s'\n", argcurrentfile, arglineno, msg, 
argyytext);
   cfg_errflag++;
  
   FREE(msg);
@@ -1592,7 +1592,7 @@
   msg= Util_formatString(s, ap, &len);
   va_end(ap);
   
-  log("%s:%i: Warning: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
+  LogWarning("%s:%i: Warning: %s '%s'\n", argcurrentfile, arglineno, msg, 
argyytext);
  
   FREE(msg);
   
@@ -1618,7 +1618,7 @@
   }
 
   if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) {
-    log("%s: Error: cannot open the control file '%s' -- %s\n",
+    LogError("%s: Error: cannot open the control file '%s' -- %s\n",
        prog, controlfile, STRERROR);
     return FALSE;
   }
@@ -1739,7 +1739,7 @@
   /* Check that we do not start monit in daemon mode without having a
    * poll time */
   if(!Run.polltime && (Run.isdaemon || Run.init)) {
-    log("%s: Error: Poll time not defined. Please define poll time"
+    LogError("%s: Error: Poll time not defined. Please define poll time"
        " in the\n control file or use the -d option when starting monit\n",
        prog);
     cfg_errflag++;
@@ -1753,8 +1753,9 @@
        continue;
     /* Verify that a remote service has a port or an icmp list */
     if(!s->portlist && !s->icmplist) {
-      log("%s: Error: 'check host' statement is incomplete; Please specify a"
-          " port number to test\n or an icmp test at the remote host: '%s'\n",
+      LogError("%s: Error: 'check host' statement is incomplete; Please"
+          " specify a port number to test\n or an icmp test at the remote"
+          " host: '%s'\n",
          prog, s->name);
       cfg_errflag++;
     }
@@ -3245,7 +3246,7 @@
       for(d= s->dependantlist; d; d= d->next) {
         Service_T dp = Util_getService(d->dependant);
         if(!dp) {
-          log("%s: Error: Depend service '%s' is not defined in the "
+          LogError("%s: Error: Depend service '%s' is not defined in the "
               "control file\n", prog, d->dependant);
           exit(1);
         }
@@ -3266,7 +3267,7 @@
   if (!done)
    {
         ASSERT(depends_on);
-       log("%s: Error: Found a depend loop in the control file "
+       LogError("%s: Error: Found a depend loop in the control file "
            "involving the service '%s'\n", prog, depends_on->name);
        exit(1);
    } 
diff -Naur monit/process/sysdep_DARWIN.c monit-mp/process/sysdep_DARWIN.c
--- monit/process/sysdep_DARWIN.c       2006-04-19 05:34:37.738772000 +0200
+++ monit-mp/process/sysdep_DARWIN.c    2006-04-19 05:40:00.810824000 +0200
@@ -144,20 +144,20 @@
   struct kinfo_proc *pinfo;
 
   if(getuid()!=0) {
-    log("system statistic error -- permission denied\n");
+    LogError("system statistic error -- permission denied\n");
     return FALSE;
   }
 
   if(!(kvm_handle = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL)))
   {
-    log("system statistic error -- cannot initialize kvm interface\n");
+    LogError("system statistic error -- cannot initialize kvm interface\n");
     return FALSE;
   }
 
   pinfo = kvm_getprocs(kvm_handle, KERN_PROC_ALL, 0, &treesize);
   if(!pinfo || (treesize < 1))
   {
-    log("system statistic error -- cannot get process tree\n");
+    LogError("system statistic error -- cannot get process tree\n");
     kvm_close(kvm_handle);
     return FALSE;
   }
diff -Naur monit/process/sysdep_FREEBSD.c monit-mp/process/sysdep_FREEBSD.c
--- monit/process/sysdep_FREEBSD.c      2006-04-19 05:34:37.742135000 +0200
+++ monit-mp/process/sysdep_FREEBSD.c   2006-04-19 05:40:00.814389000 +0200
@@ -151,20 +151,20 @@
   struct kinfo_proc *pinfo;
 
   if(getuid()!=0) {
-    log("system statistic error -- permission denied\n");
+    LogError("system statistic error -- permission denied\n");
     return FALSE;
   }
 
   if(!(kvm_handle = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL)))
   {
-    log("system statistic error -- cannot initialize kvm interface\n");
+    LogError("system statistic error -- cannot initialize kvm interface\n");
     return FALSE;
   }
 
   pinfo = kvm_getprocs(kvm_handle, KERN_PROC_ALL, 0, &treesize);
   if(!pinfo || (treesize < 1))
   {
-    log("system statistic error -- cannot get process tree\n");
+    LogError("system statistic error -- cannot get process tree\n");
     kvm_close(kvm_handle);
     return FALSE;
   }
@@ -222,7 +222,8 @@
 
   if(sysctl(mib, 2, &vm, &len, NULL, 0) == -1)
   {
-    log("system statistic error -- cannot get real memory usage: %s\n", 
STRERROR);
+    LogError("system statistic error -- cannot get real memory usage: %s\n",
+      STRERROR);
     return FALSE;
   }
 
@@ -246,14 +247,15 @@
   len = sizeof(mib);
   if(sysctlnametomib("kern.cp_time", mib, &len) == -1)
   {
-    log("system statistic error -- cannot get cpu time handler: %s\n", 
STRERROR);
+    LogError("system statistic error -- cannot get cpu time handler: %s\n",
+      STRERROR);
     return FALSE;
   }
 
   len = sizeof(cp_time);
   if(sysctl(mib, 2, &cp_time, &len, NULL, 0) == -1)
   {
-    log("system statistic error -- cannot get cpu time: %s\n", STRERROR);
+    LogError("system statistic error -- cannot get cpu time: %s\n", STRERROR);
     return FALSE;
   }
 
diff -Naur monit/process/sysdep_LINUX.c monit-mp/process/sysdep_LINUX.c
--- monit/process/sysdep_LINUX.c        2006-04-19 05:34:37.853842000 +0200
+++ monit-mp/process/sysdep_LINUX.c     2006-04-19 05:40:00.818609000 +0200
@@ -176,7 +176,7 @@
   /* Find all processes in the /proc directory */
   if(glob("/proc/[0-9]*", GLOB_ONLYDIR, NULL, &globbuf))
   {
-    log("system statistic error -- glob failed\n");
+    LogError("system statistic error -- glob failed\n");
     return FALSE;
   } 
 
@@ -289,40 +289,43 @@
   
   if(!read_proc_file(buf, 1024, "meminfo", -1))
   {
-    log("system statistic error -- cannot get real memory free amount\n");
+    LogError("system statistic error -- cannot get real memory free amount\n");
     goto error;
   }
 
   if(!(ptr= strstr(buf, MEMFREE)))
   {
-    log("system statistic error -- cannot get real memory free amount\n");
+    LogError("system statistic error -- cannot get real memory free amount\n");
     goto error;
   }
   if(sscanf(ptr + strlen(MEMFREE), "%ld", &mem_free) != 1)
   {
-    log("system statistic error -- cannot get real memory free amount\n");
+    LogError("system statistic error -- cannot get real memory free amount\n");
     goto error;
   }
 
   if(!(ptr= strstr(buf, MEMBUF)))
   {
-    log("system statistic error -- cannot get real memory beffers amount\n");
+    LogError("system statistic error -- cannot get real memory buffers "
+      "amount\n");
     goto error;
   }
   if(sscanf(ptr + strlen(MEMBUF), "%ld", &buffers) != 1)
   {
-    log("system statistic error -- cannot get real memory buffers amount\n");
+    LogError("system statistic error -- cannot get real memory buffers "
+      "amount\n");
     goto error;
   }
 
   if(!(ptr= strstr(buf, MEMCACHE)))
   {
-    log("system statistic error -- cannot get real memory cache amount\n");
+    LogError("system statistic error -- cannot get real memory cache 
amount\n");
     goto error;
   }
   if(sscanf(ptr + strlen(MEMCACHE), "%ld", &cached) != 1)
   {
-    log("system statistic error -- cannot get real memory cache free 
amount\n");
+    LogError("system statistic error -- cannot get real memory cache free "
+      "amount\n");
     goto error;
   }
 
@@ -330,14 +333,14 @@
 
   if(si->total_mem_kbyte < 0)
   {
-    log("system statistic error -- memory usage statistic error\n");
+    LogError("system statistic error -- memory usage statistic error\n");
     goto error;
   }
 
   return TRUE;
 
   error:
-  log("system statistic error -- memory usage gathering failed\n");
+  LogError("system statistic error -- memory usage gathering failed\n");
   si->total_mem_kbyte = 0;
   return FALSE;
 }
@@ -357,14 +360,14 @@
 
   if(!read_proc_file(buf, 1024, "stat", -1))
   {
-    log("system statistic error -- cannot read /proc/stat\n");
+    LogError("system statistic error -- cannot read /proc/stat\n");
     goto error;
   }
 
   rv = sscanf(buf, "cpu %ld %*d %ld %*d %ld", &cpu_user, &cpu_syst, &cpu_wait);
   if(rv < 2 || rv > 3)
   {
-    log("system statistic error -- cannot read cpu usage\n");
+    LogError("system statistic error -- cannot read cpu usage\n");
     goto error;
   }
   else
diff -Naur monit/process/sysdep_NETBSD.c monit-mp/process/sysdep_NETBSD.c
--- monit/process/sysdep_NETBSD.c       2006-04-19 05:34:37.857075000 +0200
+++ monit-mp/process/sysdep_NETBSD.c    2006-04-19 05:40:00.822554000 +0200
@@ -148,20 +148,20 @@
   struct kinfo_proc *pinfo;
 
   if(getuid()!=0) {
-    log("system statistic error -- permission denied\n");
+    LogError("system statistic error -- permission denied\n");
     return FALSE;
   }
 
   if(!(kvm_handle = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL)))
   {
-    log("system statistic error -- cannot initialize kvm interface\n");
+    LogError("system statistic error -- cannot initialize kvm interface\n");
     return FALSE;
   }
 
   pinfo = kvm_getprocs(kvm_handle, KERN_PROC_ALL, 0, &treesize);
   if(!pinfo || (treesize < 1))
   {
-    log("system statistic error -- cannot get process tree\n");
+    LogError("system statistic error -- cannot get process tree\n");
     kvm_close(kvm_handle);
     return FALSE;
   }
@@ -213,7 +213,8 @@
 
   if(sysctl(mib, 2, &vm, &len, NULL, 0) == -1)
   {
-    log("system statistic error -- cannot get real memory usage: %s\n", 
STRERROR);
+    LogError("system statistic error -- cannot get real memory usage: %s\n",
+      STRERROR);
     return FALSE;
   }
 
@@ -237,7 +238,7 @@
   len = sizeof(cp_time);
   if(sysctl(mib, 2, &cp_time, &len, NULL, 0) == -1)
   {
-    log("system statistic error -- cannot get cpu time: %s\n", STRERROR);
+    LogError("system statistic error -- cannot get cpu time: %s\n", STRERROR);
     return FALSE;
   }
 
diff -Naur monit/process/sysdep_OPENBSD.c monit-mp/process/sysdep_OPENBSD.c
--- monit/process/sysdep_OPENBSD.c      2006-04-19 05:34:37.869819000 +0200
+++ monit-mp/process/sysdep_OPENBSD.c   2006-04-19 05:40:00.825968000 +0200
@@ -148,20 +148,20 @@
   struct kinfo_proc *pinfo;
 
   if(getuid()!=0) {
-    log("system statistic error -- permission denied\n");
+    LogError("system statistic error -- permission denied\n");
     return FALSE;
   }
 
   if(!(kvm_handle = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL)))
   {
-    log("system statistic error -- cannot initialize kvm interface\n");
+    LogError("system statistic error -- cannot initialize kvm interface\n");
     return FALSE;
   }
 
   pinfo = kvm_getprocs(kvm_handle, KERN_PROC_ALL, 0, &treesize);
   if(!pinfo || (treesize < 1))
   {
-    log("system statistic error -- cannot get process tree\n");
+    LogError("system statistic error -- cannot get process tree\n");
     kvm_close(kvm_handle);
     return FALSE;
   }
@@ -213,7 +213,8 @@
 
   if(sysctl(mib, 2, &vm, &len, NULL, 0) == -1)
   {
-    log("system statistic error -- cannot get real memory usage: %s\n", 
STRERROR);
+    LogError("system statistic error -- cannot get real memory usage: %s\n",
+      STRERROR);
     return FALSE;
   }
 
@@ -237,7 +238,7 @@
   len = sizeof(cp_time);
   if(sysctl(mib, 2, &cp_time, &len, NULL, 0) == -1)
   {
-    log("system statistic error -- cannot get cpu time: %s\n", STRERROR);
+    LogError("system statistic error -- cannot get cpu time: %s\n", STRERROR);
     return FALSE;
   }
 
diff -Naur monit/process/sysdep_SOLARIS.c monit-mp/process/sysdep_SOLARIS.c
--- monit/process/sysdep_SOLARIS.c      2006-04-19 05:34:37.873138000 +0200
+++ monit-mp/process/sysdep_SOLARIS.c   2006-04-19 05:40:00.829336000 +0200
@@ -262,7 +262,7 @@
   kstat = kstat_lookup(kctl, "unix", 0, "system_pages");
 
   if (kstat_read(kctl, kstat, 0) == -1) {
-    log("system statistic error -- memory usage gathering failed\n");
+    LogError("system statistic error -- memory usage gathering failed\n");
     kstat_close(kctl);
     return FALSE;
   }
diff -Naur monit/process.c monit-mp/process.c
--- monit/process.c     2006-04-19 05:34:36.948281000 +0200
+++ monit-mp/process.c  2006-04-19 05:40:00.834198000 +0200
@@ -199,7 +199,7 @@
     /** Get load average triplet */
     if(-1 == getloadavg_sysdep(systeminfo.loadavg, 3))
     {
-      log("'%s' statistic error -- load average gathering failed\n",
+      LogError("'%s' statistic error -- load average gathering failed\n",
         Run.system->name);
       goto error1;
     }
@@ -216,7 +216,7 @@
       }
       else
       {
-        log("'%s' statistic error -- memory usage gathering failed\n",
+        LogError("'%s' statistic error -- memory usage gathering failed\n",
           Run.system->name);
         goto error2;
       }
@@ -238,7 +238,7 @@
       }
       else
       {
-        log("'%s' statistic error -- cpu usage gathering failed\n",
+        LogError("'%s' statistic error -- cpu usage gathering failed\n",
           Run.system->name);
         goto error3;
       }
diff -Naur monit/protocols/apache_status.c monit-mp/protocols/apache_status.c
--- monit/protocols/apache_status.c     2006-04-19 05:34:37.903579000 +0200
+++ monit-mp/protocols/apache_status.c  2006-04-19 05:40:00.840757000 +0200
@@ -78,7 +78,7 @@
                  "Connection: close\r\n\r\n",
                  request, Util_getHTTPHostHeader(s, host, STRLEN), 
                  prog, VERSION) < 0) {
-    log("HTTP: error sending data -- %s\n", STRERROR);
+    LogError("HTTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
   
@@ -149,7 +149,8 @@
     if(Util_startsWith(line, "Scoreboard")) {   
       if(1 != sscanf(line, "%*s%*[: ]%s", search_string)) {
        Util_chomp(line);
-       log("APACHE-STATUS error: parsing Apache status response '%s'\n", line);
+       LogError("APACHE-STATUS error: parsing Apache status response '%s'\n",
+         line);
        return FALSE;
       }else{
         scored = 1;
@@ -161,7 +162,7 @@
   
   /* Check that some scoreboard line was found, if not return an error */
   if(!scored){
-    log("APACHE-STATUS error: no scoreboard line returned by Apache\n");
+    LogError("APACHE-STATUS error: no scoreboard line returned by Apache\n");
     return FALSE;
   }
   
@@ -206,7 +207,7 @@
   }
 
   if(active_servers <= 0){
-    log("APACHE-STATUS warning: No idle server or threads found\n");
+    LogError("APACHE-STATUS warning: No idle server or threads found\n");
     /* This is not really an error, only a very bussy server */
     return TRUE;
   }
@@ -218,7 +219,7 @@
   if(loglimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.loglimitOP, 
                            (100 * no_logging / active_servers), loglimit)) {
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
           " %i percent of Apache processes are logging\n", loglimit);
       errors++;
     }
@@ -227,7 +228,7 @@
   if(startlimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.startlimitOP, 
                            (100 * no_start / active_servers), startlimit)) {
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
           " %i percent of Apache processes are starting\n", startlimit);
       errors++;
     }
@@ -236,7 +237,7 @@
   if(requestlimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.requestlimitOP, 
                    (100 * no_request / active_servers), requestlimit)) {
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
           " %i percent of Apache processes are reading requests\n", 
          requestlimit);
       errors++;
@@ -246,7 +247,7 @@
   if(replylimit > 0 ){
     if(Util_evalQExpression(myPort->ApacheStatus.replylimitOP, 
                            (100 * no_reply / active_servers), replylimit)) {
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
           " %i percent of Apache processes are sending a reply\n", replylimit);
       errors++;
     }
@@ -255,7 +256,7 @@
   if(keepalivelimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.keepalivelimitOP, 
                    (100 * no_keepalive / active_servers), keepalivelimit)) {
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
          " %i percent of Apache processes are in keepalive\n", keepalivelimit);
       errors++;
     }
@@ -264,7 +265,7 @@
   if(dnslimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.dnslimitOP, 
                            (100 * no_dns / active_servers), dnslimit)) {
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
          " %i percent of Apache processes are waiting for DNS\n", dnslimit);
       errors++;
     }
@@ -273,7 +274,7 @@
   if(closelimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.closelimitOP, 
                            (100 * no_close / active_servers), closelimit)){
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
          " %i percent of Apache processes are closing connections\n", 
          closelimit);
       errors++;
@@ -283,7 +284,7 @@
   if(gracefullimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.gracefullimitOP, 
                     (100 * no_graceful / active_servers), gracefullimit)) {
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
          " %i percent of Apache processes are finishing gracefully\n", 
          gracefullimit);
       errors++;
@@ -293,7 +294,7 @@
   if(cleanuplimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.cleanuplimitOP, 
                    (100 * no_cleanup / active_servers), cleanuplimit)) {
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
          " %i percent of Apache processes are in idle cleanup\n", 
          cleanuplimit);
       errors++;
@@ -303,7 +304,7 @@
   if(waitlimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.waitlimitOP, 
                            (100 * no_wait / active_servers), waitlimit)) {
-      log("APACHE-STATUS error:"
+      LogError("APACHE-STATUS error:"
          " %i percent of Apache processes are waiting for a connection\n", 
          waitlimit);
       errors++;
diff -Naur monit/protocols/dns.c monit-mp/protocols/dns.c
--- monit/protocols/dns.c       2006-04-19 05:34:37.906975000 +0200
+++ monit-mp/protocols/dns.c    2006-04-19 05:40:00.844490000 +0200
@@ -106,21 +106,21 @@
       offset_response = 2; /*  Skip Length field in response */
       break;
     default:
-      log("DNS: unsupported socket type -- protocol test skipped\n");
+      LogError("DNS: unsupported socket type -- protocol test skipped\n");
       return TRUE;
   }
 
   if(socket_write(s, (unsigned char *)request + offset_request,
                   sizeof(request) - offset_request) < 0)
   {
-    log("DNS: error sending query -- %s\n", STRERROR);
+    LogError("DNS: error sending query -- %s\n", STRERROR);
     return FALSE;
   }
 
   /* Response should have at least 14 bytes */
   if(socket_read(s, (unsigned char *)buf, 15) <= 14)
   {
-    log("DNS: error receiving response -- %s\n", STRERROR);
+    LogError("DNS: error receiving response -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -129,7 +129,7 @@
   /* Compare transaction ID (it should be the same as in our request): */
   if(response[0] != 0x00 && response[1] != 0x01)
   {
-    log("DNS: transaction ID mismatch\n");
+    LogError("DNS: transaction ID mismatch\n");
     return FALSE;
   }
 
@@ -137,27 +137,27 @@
 
   if((response[2] & 0x80) != 0x80) /* Response type */
   {
-    log("DNS: message is not response\n");
+    LogError("DNS: message is not response\n");
     return FALSE;
   }
 
   if((response[3] & 0x0F) != 0x00) /* Response code */
   {
-    log("DNS: invalid reply code -- error occured\n");
+    LogError("DNS: invalid reply code -- error occured\n");
     return FALSE;
   }
 
   /* Compare queries count (it should be one as in our request): */
   if(response[4] != 0x00 && response[5] != 0x01)
   {
-    log("DNS: query count mismatch\n");
+    LogError("DNS: query count mismatch\n");
     return FALSE;
   }
 
   /* Compare answer resource records count (it should not be zero): */
   if(response[6] == 0x00 && response[7] == 0x00)
   {
-    log("DNS: no answer records returned\n");
+    LogError("DNS: no answer records returned\n");
     return FALSE;
   }
 
diff -Naur monit/protocols/dwp.c monit-mp/protocols/dwp.c
--- monit/protocols/dwp.c       2006-04-19 05:34:37.910303000 +0200
+++ monit-mp/protocols/dwp.c    2006-04-19 05:40:00.847788000 +0200
@@ -80,12 +80,12 @@
 
   if(socket_print(s, "HEAD / HTTP/1.1\r\n"
                  "Connection: close\r\n\r\n") < 0) {
-    log("DWP: error sending data -- %s\n", STRERROR);
+    LogError("DWP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
   
   if(! socket_readln(s, buf, sizeof(buf))) {
-    log("DWP: error receiving data -- %s\n", STRERROR);
+    LogError("DWP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -93,7 +93,7 @@
 
   n= sscanf(buf, "%s %d", proto, &status);
   if(n!=2 || (status >= 400)) {
-    log("DWP error: %s\n", buf);
+    LogError("DWP error: %s\n", buf);
     return FALSE;
   }
   
diff -Naur monit/protocols/ftp.c monit-mp/protocols/ftp.c
--- monit/protocols/ftp.c       2006-04-19 05:34:37.912972000 +0200
+++ monit-mp/protocols/ftp.c    2006-04-19 05:40:00.851400000 +0200
@@ -52,7 +52,7 @@
   ASSERT(s);
 
   if(!socket_readln(s, buf, STRLEN)) {
-    log("FTP: error receiving data -- %s\n", STRERROR);
+    LogError("FTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -60,17 +60,17 @@
   
   sscanf(buf, "%d %*s", &status);
   if(status != 220) {
-    log("FTP error: %s\n", buf);
+    LogError("FTP error: %s\n", buf);
     return FALSE;
   }
 
   if(socket_print(s, "QUIT\r\n") < 0) {
-    log("FTP: error sending data -- %s\n", STRERROR);
+    LogError("FTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(!socket_readln(s, buf, STRLEN)) {
-    log("FTP: error receiving data -- %s\n", STRERROR);
+    LogError("FTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -78,7 +78,7 @@
 
   sscanf(buf, "%d %*s", &status);
   if(status != 221) {
-    log("FTP error: %s\n", buf);
+    LogError("FTP error: %s\n", buf);
     return FALSE;
   }
 
diff -Naur monit/protocols/generic.c monit-mp/protocols/generic.c
--- monit/protocols/generic.c   2006-04-19 05:34:37.915545000 +0200
+++ monit-mp/protocols/generic.c        2006-04-19 05:40:00.862131000 +0200
@@ -76,7 +76,7 @@
       
       if(socket_write(s, X, l) < 0) {
 
-        log("GENERIC: error sending data -- %s\n", STRERROR);
+        LogError("GENERIC: error sending data -- %s\n", STRERROR);
         return FALSE;
 
       } else {
@@ -92,7 +92,7 @@
       /* Need read, not readln here */
       if((n= socket_read(s, buf, STRLEN))<0) {
         
-        log("GENERIC: error receiving data -- %s\n", STRERROR);
+        LogError("GENERIC: error receiving data -- %s\n", STRERROR);
         return FALSE;
         
       }
@@ -106,7 +106,7 @@
                             0);
       if (regex_return != 0) {
 
-        log("GENERIC: receiving unexpected data [%s]\n", buf);
+        LogError("GENERIC: receiving unexpected data [%s]\n", buf);
         return FALSE;
 
       } else {
@@ -120,7 +120,7 @@
 
       if ( strncmp(buf, g->expect, strlen(g->expect)) != 0 ) {
 
-        log("GENERIC: receiving unexpected data [%s]\n", buf);
+        LogError("GENERIC: receiving unexpected data [%s]\n", buf);
         return FALSE;
 
       } else {
@@ -134,7 +134,7 @@
     } else {
 
       /* This should not happen */
-      log("GENERIC: unexpected strageness\n");
+      LogError("GENERIC: unexpected strageness\n");
       return FALSE;
       
     }
diff -Naur monit/protocols/http.c monit-mp/protocols/http.c
--- monit/protocols/http.c      2006-04-19 05:34:37.999895000 +0200
+++ monit-mp/protocols/http.c   2006-04-19 05:40:00.868259000 +0200
@@ -135,7 +135,7 @@
                  "%s\r\n",
                  request, Util_getHTTPHostHeader(s, host, STRLEN), 
                  prog, VERSION, get_auth_header(P, auth, STRLEN)) < 0) {
-    log("HTTP: error sending data -- %s\n", STRERROR);
+    LogError("HTTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -179,7 +179,7 @@
          
   default:
     if(H.status>=400) {
-      log("HTTP error: Server returned status %d\n", H.status);
+      LogError("HTTP error: Server returned status %d\n", H.status);
       return FALSE;
     }
     
@@ -187,7 +187,7 @@
   
   if(P->url_request && P->url_request->regex) {
     if(! do_regex(&H, P->url_request)) {
-      log("HTTP error: Failed regular expression test on content"
+      LogError("HTTP error: Failed regular expression test on content"
          " returned from server\n");
       return FALSE;
     }
@@ -289,7 +289,8 @@
   }
 
   if(H->content_length == 0) {
-    log("HTTP error: Cannot test regex -- No content returned from server\n");
+    LogError("HTTP error: Cannot test regex -- No content returned "
+      "from server\n");
     return FALSE;
   }
  
@@ -313,7 +314,7 @@
   
   if(size==0) {
     rv= FALSE;
-    log("HTTP: error receiving data -- %s\n", STRERROR);
+    LogError("HTTP: error receiving data -- %s\n", STRERROR);
     goto error;
   }
   buf[size]= 0;
@@ -346,7 +347,7 @@
        break;
 
       default:
-       log("HTTP error: Invalid content operator\n");
+       LogError("HTTP error: Invalid content operator\n");
       }
        
 #else
@@ -370,7 +371,7 @@
        break;
 
       default:
-       log("HTTP error: Invalid content operator\n");
+       LogError("HTTP error: Invalid content operator\n");
       }
       
 #endif
@@ -463,14 +464,14 @@
   H->content_length= -1;
 
   if(! socket_readln(H->s, buf, LINE_SIZE)) {
-    log("HTTP: error receiving data -- %s\n", STRERROR);
+    LogError("HTTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
   Util_chomp(buf);
 
   if(sscanf(buf, "%*s %d", &H->status) !=1) {
-    log("HTTP error: cannot parse HTTP status in response: %s\n", buf);
+    LogError("HTTP error: cannot parse HTTP status in response: %s\n", buf);
     return FALSE;
   }
 
@@ -483,18 +484,21 @@
    
     if(Util_startsWith(buf, "Content-Length")) {
       if(1 != sscanf(buf, "%*s%*[: ]%ld", &H->content_length)) {
-       log("HTTP error: parsing Content-Length response header '%s'\n", buf);
+        LogError("HTTP error: parsing Content-Length response header '%s'\n",
+          buf);
        return FALSE;
       }
       if(H->content_length < 0) {
-       log("HTTP error: Illegal Content-Length response header '%s'\n", buf);
+       LogError("HTTP error: Illegal Content-Length response header '%s'\n",
+          buf);
        return FALSE;
       }
     }
     
     if(Util_startsWith(buf, "Location")) {
       if(1 != sscanf(buf, "%*s%*[: ]%s", H->location)) {
-       log("HTTP error: parsing Location response header '%s'\n", buf);
+       LogError("HTTP error: parsing Location response header '%s'\n",
+          buf);
        return FALSE;
       }
     }
@@ -502,7 +506,8 @@
     if(Util_startsWith(buf, "Connection")) {
       char *p= strchr(buf, ':');
       if(!p) {
-       log("HTTP error: parsing Connection response header '%s'\n", buf);
+       LogError("HTTP error: parsing Connection response header '%s'\n",
+          buf);
        return FALSE;
       }
       Util_trim(++p);
@@ -513,7 +518,7 @@
       char *s;
       char *p= strchr(buf, ':');
       if(!p) {
-       log("HTTP error: parsing Cookie response header '%s'\n", buf);
+       LogError("HTTP error: parsing Cookie response header '%s'\n", buf);
        return FALSE;
       }
       Util_trim(++p);
diff -Naur monit/protocols/imap.c monit-mp/protocols/imap.c
--- monit/protocols/imap.c      2006-04-19 05:34:38.003372000 +0200
+++ monit-mp/protocols/imap.c   2006-04-19 05:40:00.871694000 +0200
@@ -57,31 +57,31 @@
   ASSERT(s);
   
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("IMAP: error receiving data -- %s\n", STRERROR);
+    LogError("IMAP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
   Util_chomp(buf);
   
   if(strncasecmp(buf, ok, strlen(ok)) != 0) {
-    log("IMAP error: %s\n", buf);
+    LogError("IMAP error: %s\n", buf);
     return FALSE;
   }
   
   if(socket_print(s, "001 LOGOUT\r\n") < 0) {
-    log("IMAP: error sending data -- %s\n", STRERROR);
+    LogError("IMAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("IMAP: error receiving data -- %s\n", STRERROR);
+    LogError("IMAP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
   Util_chomp(buf);
   
   if(strncasecmp(buf, bye, strlen(bye)) != 0) {
-    log("IMAP error: %s\n", buf);
+    LogError("IMAP error: %s\n", buf);
     return FALSE;
   }
 
diff -Naur monit/protocols/ldap2.c monit-mp/protocols/ldap2.c
--- monit/protocols/ldap2.c     2006-04-19 05:34:38.006253000 +0200
+++ monit-mp/protocols/ldap2.c  2006-04-19 05:40:00.874656000 +0200
@@ -123,24 +123,24 @@
 
 
   if(socket_write(s, (unsigned char *)request, sizeof(request)) < 0) {
-    log("LDAP: error sending data -- %s\n", STRERROR);
+    LogError("LDAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, (unsigned char *)buf, sizeof(response)) <= 0) {
-    log("LDAP: error receiving data -- %s\n", STRERROR);
+    LogError("LDAP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(memcmp((unsigned char *)buf,
            (unsigned char *)response,
            sizeof(response))) {
-    log("LDAP: anonymous bind failed\n");
+    LogError("LDAP: anonymous bind failed\n");
     return FALSE;
   }
 
   if(socket_write(s, (unsigned char *)unbind, sizeof(unbind)) < 0) {
-    log("LDAP: error sending data -- %s\n", STRERROR);
+    LogError("LDAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
diff -Naur monit/protocols/ldap3.c monit-mp/protocols/ldap3.c
--- monit/protocols/ldap3.c     2006-04-19 05:34:38.009081000 +0200
+++ monit-mp/protocols/ldap3.c  2006-04-19 05:40:00.877572000 +0200
@@ -123,24 +123,24 @@
 
 
   if(socket_write(s, (unsigned char *)request, sizeof(request)) < 0) {
-    log("LDAP: error sending data -- %s\n", STRERROR);
+    LogError("LDAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, (unsigned char *)buf, sizeof(response)) <= 0) {
-    log("LDAP: error receiving data -- %s\n", STRERROR);
+    LogError("LDAP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(memcmp((unsigned char *)buf,
            (unsigned char *)response,
            sizeof(response))) {
-    log("LDAP: anonymous bind failed\n");
+    LogError("LDAP: anonymous bind failed\n");
     return FALSE;
   }
 
   if(socket_write(s, (unsigned char *)unbind, sizeof(unbind)) < 0) {
-    log("LDAP: error sending data -- %s\n", STRERROR);
+    LogError("LDAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
diff -Naur monit/protocols/mysql.c monit-mp/protocols/mysql.c
--- monit/protocols/mysql.c     2006-04-19 05:34:38.011851000 +0200
+++ monit-mp/protocols/mysql.c  2006-04-19 05:40:00.881155000 +0200
@@ -105,24 +105,24 @@
   ASSERT(s);
 
   if(!socket_readln(s, (char *)buf, sizeof(buf))) {
-    log("MYSQL: error receiving greeting -- %s\n", STRERROR);
+    LogError("MYSQL: error receiving greeting -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_write(s, requestLogin, sizeof(requestLogin)) < 0) {
-    log("MYSQL: error sending login -- %s\n", STRERROR);
+    LogError("MYSQL: error sending login -- %s\n", STRERROR);
     return FALSE;
   }
 
   /* read just first few bytes  which contains enough information */
   if(socket_read(s, buf, 7) <= 6) {
-    log("MYSQL: error receiving login response -- %s\n", STRERROR);
+    LogError("MYSQL: error receiving login response -- %s\n", STRERROR);
     return FALSE;
   }
 
   /* Compare Packet Number: */
   if(buf[3] != 0x02) {
-    log("MYSQL: invalid response packet number\n");
+    LogError("MYSQL: invalid response packet number\n");
     return FALSE;
   }
 
@@ -131,23 +131,23 @@
   /* If OK, we are loged in and will perform MySQL ping */
   if(buf[4] == 0x00) {
     if(socket_write(s, (unsigned char *)requestPing, sizeof(requestPing)) < 0) 
{
-      log("MYSQL: error sending ping -- %s\n", STRERROR);
+      LogError("MYSQL: error sending ping -- %s\n", STRERROR);
       return FALSE;
     }
 
     if(socket_read(s, buf, sizeof(responsePing)) <= 0) {
-      log("MYSQL: error receiving ping response -- %s\n", STRERROR);
+      LogError("MYSQL: error receiving ping response -- %s\n", STRERROR);
       return FALSE;
     }
 
     if(memcmp((unsigned char *)buf,
              (unsigned char *)responsePing, sizeof(responsePing))) {
-      log("MYSQL: ping failed\n");
+      LogError("MYSQL: ping failed\n");
       return FALSE;
     }
 
     if(socket_write(s, (unsigned char *)requestQuit, sizeof(requestQuit)) < 0) 
{
-      log("MYSQL: error sending quit -- %s\n", STRERROR);
+      LogError("MYSQL: error sending quit -- %s\n", STRERROR);
       return FALSE;
     }
 
@@ -158,7 +158,7 @@
     return TRUE;
   }
 
-  log("MYSQL: login failed\n");
+  LogError("MYSQL: login failed\n");
 
   return FALSE;
 }
diff -Naur monit/protocols/nntp.c monit-mp/protocols/nntp.c
--- monit/protocols/nntp.c      2006-04-19 05:34:38.014437000 +0200
+++ monit-mp/protocols/nntp.c   2006-04-19 05:40:00.884601000 +0200
@@ -51,7 +51,7 @@
   ASSERT(s);
 
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("NNTP: error receiving data -- %s\n", STRERROR);
+    LogError("NNTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -59,17 +59,17 @@
   
   sscanf(buf, "%d %*s", &status);
   if(status != 200) {
-    log("NNTP error: %s\n", buf);
+    LogError("NNTP error: %s\n", buf);
     return FALSE;
   }
   
   if(socket_print(s, "QUIT\r\n") < 0) {
-    log("NNTP: error sending data -- %s\n", STRERROR);
+    LogError("NNTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("NNTP: error receiving data -- %s\n", STRERROR);
+    LogError("NNTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -77,7 +77,7 @@
 
   sscanf(buf, "%d %*s", &status);
   if(status != 205) {
-    log("NNTP error: %s\n", buf);
+    LogError("NNTP error: %s\n", buf);
     return FALSE;
   }
 
diff -Naur monit/protocols/ntp3.c monit-mp/protocols/ntp3.c
--- monit/protocols/ntp3.c      2006-04-19 05:34:38.114826000 +0200
+++ monit-mp/protocols/ntp3.c   2006-04-19 05:40:00.887704000 +0200
@@ -82,18 +82,19 @@
 
   /* Send request to NTP server */
   if( (br= socket_write(s, ntpRequest, NTPLEN)) <= 0 ) {
-    log("NTP: error sending NTP request -- %s\n", STRERROR);
+    LogError("NTP: error sending NTP request -- %s\n", STRERROR);
     return FALSE;
   }
 
   /* Receive and validate response */
   if( (br= socket_read(s, ntpResponse, NTPLEN)) <= 0) {
-    log("NTP: did not receive answer from server -- %s\n", STRERROR);
+    LogError("NTP: did not receive answer from server -- %s\n", STRERROR);
     return FALSE;
   }
 
   if( br != NTPLEN ) {
-    log("NTP: Received %d bytes from server, expected %d bytes\n", br, NTPLEN);
+    LogError("NTP: Received %d bytes from server, expected %d bytes\n",
+      br, NTPLEN);
     return FALSE;
   }
 
@@ -105,17 +106,17 @@
    */
   if( (ntpResponse[0] & 0x07) != NTP_MODE_SERVER )
   {
-    log("NTP: Server mode error\n");
+    LogError("NTP: Server mode error\n");
     return FALSE;
   }
   if( (ntpResponse[0] & 0x38) != NTP_VERSION<<3 )
   {
-    log("NTP: Server protocol version error\n");
+    LogError("NTP: Server protocol version error\n");
     return FALSE;
   }
   if( (ntpResponse[0] & 0xc0) == NTP_LEAP_NOTSYNC<<6 )
   {
-    log("NTP: Server not synchronized\n");
+    LogError("NTP: Server not synchronized\n");
     return FALSE;
   }
 
diff -Naur monit/protocols/pgsql.c monit-mp/protocols/pgsql.c
--- monit/protocols/pgsql.c     2006-04-19 05:34:38.117526000 +0200
+++ monit-mp/protocols/pgsql.c  2006-04-19 05:40:00.891289000 +0200
@@ -110,13 +110,13 @@
   ASSERT(s);
 
   if(socket_write(s, (unsigned char *)requestLogin, sizeof(requestLogin)) <= 
0) {
-    log("PGSQL: error sending data -- %s\n", STRERROR);
+    LogError("PGSQL: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   /** Nine-byte is enough to hold Auth-Ok */
   if(socket_read(s, buf, 9) <= 0) {
-    log("PGSQL: error receiving data -- %s\n", STRERROR);
+    LogError("PGSQL: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -137,7 +137,7 @@
     return TRUE;
   }
 
-  log("PGSQL: unknown error\n");
+  LogError("PGSQL: unknown error\n");
   
   return FALSE;
 }
diff -Naur monit/protocols/pop.c monit-mp/protocols/pop.c
--- monit/protocols/pop.c       2006-04-19 05:34:38.121090000 +0200
+++ monit-mp/protocols/pop.c    2006-04-19 05:40:00.894178000 +0200
@@ -55,31 +55,31 @@
   ASSERT(s);
   
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("POP: error receiving data -- %s\n", STRERROR);
+    LogError("POP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
   Util_chomp(buf);
   
   if(strncasecmp(buf, ok, strlen(ok)) != 0) {
-    log("POP error: %s\n", buf);
+    LogError("POP error: %s\n", buf);
     return FALSE;
   }
   
   if(socket_print(s, "QUIT\r\n") < 0) {
-    log("POP: error sending data -- %s\n", STRERROR);
+    LogError("POP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("POP: error receiving data -- %s\n", STRERROR);
+    LogError("POP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
   Util_chomp(buf);
   
   if(strncasecmp(buf, ok, strlen(ok)) != 0) {
-    log("POP error: %s\n", buf);
+    LogError("POP error: %s\n", buf);
     return FALSE;
   }
 
diff -Naur monit/protocols/postfix_policy.c monit-mp/protocols/postfix_policy.c
--- monit/protocols/postfix_policy.c    2006-04-19 05:34:38.123675000 +0200
+++ monit-mp/protocols/postfix_policy.c 2006-04-19 05:40:00.896961000 +0200
@@ -85,19 +85,20 @@
     "client_address=1.2.3.4\n"
     "client_name=mx.foo.tld\n"
     "\n") < 0) {
-    log("POSTFIX-POLICY: error sending data -- %s\n", STRERROR);
+    LogError("POSTFIX-POLICY: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
   
   if(! socket_readln(s, buf, sizeof(buf))) {
-    log("POSTFIX-POLICY: error receiving data -- %s\n", STRERROR);
+    LogError("POSTFIX-POLICY: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
   Util_chomp(buf);
 
   if( (strlen(buf) <= 7) || strncasecmp(buf, "action=", 7) ) {
-    log("POSTFIX-POLICY error: %s\n", (buf && *buf)?buf:"no action returned");
+    LogError("POSTFIX-POLICY error: %s\n",
+      (buf && *buf)?buf:"no action returned");
     return FALSE;
   }
   
diff -Naur monit/protocols/rdate.c monit-mp/protocols/rdate.c
--- monit/protocols/rdate.c     2006-04-19 05:34:38.162073000 +0200
+++ monit-mp/protocols/rdate.c  2006-04-19 05:40:00.900618000 +0200
@@ -66,7 +66,7 @@
   ASSERT(s);
   
   if(socket_read(s,(char*) &rdatet, sizeof(time_t)) <= 0) {
-    log("RDATE: error receiving data -- %s\n", STRERROR);
+    LogError("RDATE: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
   
@@ -74,7 +74,7 @@
   rdatet = ntohl(rdatet) - TIME_OFFSET;
   
   if((systemt = time(NULL)) == -1) {
-    log("RDATE error: cannot get system time -- %s\n", STRERROR);
+    LogError("RDATE error: cannot get system time -- %s\n", STRERROR);
     return FALSE;
   }
    
@@ -84,7 +84,7 @@
     delta= (systemt-rdatet);
  
   if(delta > TIME_TOLERANCE) {
-    log("RDATE error: time does not match system time -- %s\n", STRERROR);
+    LogError("RDATE error: time does not match system time -- %s\n", STRERROR);
     return FALSE;
   }
   
diff -Naur monit/protocols/rsync.c monit-mp/protocols/rsync.c
--- monit/protocols/rsync.c     2006-04-19 05:34:38.164916000 +0200
+++ monit-mp/protocols/rsync.c  2006-04-19 05:40:00.904435000 +0200
@@ -54,7 +54,7 @@
   ASSERT(s);
     
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("RSYNC: did not see server greeting  -- %s\n", STRERROR);
+    LogError("RSYNC: did not see server greeting  -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -62,32 +62,32 @@
   
   rc = sscanf(buf, "%s %d", msg, &version);
   if ((rc == EOF) || (rc == 0)) {
-     log("RSYNC: server greeting parse error %s\n", buf);
+     LogError("RSYNC: server greeting parse error %s\n", buf);
     return FALSE;
   }
    
   if(strncasecmp(msg, rsyncd, strlen(rsyncd)) != 0) {
-    log("RSYNC: server sent \"%s\" rather than greeting\n", buf);
+    LogError("RSYNC: server sent \"%s\" rather than greeting\n", buf);
     return FALSE;
   }
 
   if(snprintf(buf, sizeof(buf), "%s %d\n", rsyncd, version) < 0) {
-    log("RSYNC: string copy error -- %s\n", STRERROR);
+    LogError("RSYNC: string copy error -- %s\n", STRERROR);
     return FALSE;
   } 
        
   if(socket_write(s, buf, strlen(buf)) <= 0) {
-    log("RSYNC: error sending identification string -- %s\n", STRERROR);
+    LogError("RSYNC: error sending identification string -- %s\n", STRERROR);
      return FALSE;
   }
 
   if(socket_print(s, "#list\n") < 0) {
-    log("RSYNC: error sending writing #list command  -- %s\n", STRERROR);
+    LogError("RSYNC: error sending writing #list command  -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("RSYNC: did not see server answer  -- %s\n", STRERROR);
+    LogError("RSYNC: did not see server answer  -- %s\n", STRERROR);
     return FALSE;
   }
   
diff -Naur monit/protocols/smtp.c monit-mp/protocols/smtp.c
--- monit/protocols/smtp.c      2006-04-19 05:34:38.242440000 +0200
+++ monit-mp/protocols/smtp.c   2006-04-19 05:40:00.907885000 +0200
@@ -52,7 +52,7 @@
   ASSERT(s);
   
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("SMTP: error receiving data -- %s\n", STRERROR);
+    LogError("SMTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
   
@@ -60,19 +60,19 @@
   
   sscanf(buf, "%d%*s", &status);
   if(status != 220) {
-    log("SMTP error: %s\n", buf);
+    LogError("SMTP error: %s\n", buf);
     return FALSE;
   }
   
   /* Terminate the session */
   if(socket_print(s, "QUIT\r\n") < 0) {
-    log("SMTP: error sending data -- %s\n", STRERROR);
+    LogError("SMTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
   
   /* Check the reply */
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("SMTP: error receiving data -- %s\n", STRERROR);
+    LogError("SMTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
   
@@ -80,7 +80,7 @@
   
   sscanf(buf, "%d%*s", &status);
   if(status != 221) {
-    log("SMTP error: %s\n", buf);
+    LogError("SMTP error: %s\n", buf);
     return FALSE;
   }
   
diff -Naur monit/protocols/ssh.c monit-mp/protocols/ssh.c
--- monit/protocols/ssh.c       2006-04-19 05:34:38.245206000 +0200
+++ monit-mp/protocols/ssh.c    2006-04-19 05:40:00.911076000 +0200
@@ -48,18 +48,18 @@
   ASSERT(s);
     
   if(!socket_readln(s, buf, sizeof(buf))) {
-    log("SSH: error receiving identification string -- %s\n", STRERROR);
+    LogError("SSH: error receiving identification string -- %s\n", STRERROR);
     return FALSE;
   }
   
   if(! Util_startsWith(buf, "SSH-")) {
-    log("SSH: protocol error %s", buf);
+    LogError("SSH: protocol error %s", buf);
     return FALSE;
   }
 
   /* send identification string back to server */
   if(socket_write(s, buf, strlen(buf)) <= 0) {
-    log("SSH: error sending identification string -- %s\n", STRERROR);
+    LogError("SSH: error sending identification string -- %s\n", STRERROR);
     return FALSE;
   }
    
diff -Naur monit/protocols/tns.c monit-mp/protocols/tns.c
--- monit/protocols/tns.c       2006-04-19 05:34:38.247723000 +0200
+++ monit-mp/protocols/tns.c    2006-04-19 05:40:00.914370000 +0200
@@ -87,20 +87,20 @@
   ASSERT(s);
 
   if(socket_write(s, (unsigned char *)requestPing, sizeof(requestPing)) < 0) {
-    log("TNS: error sending ping -- %s\n", STRERROR);
+    LogError("TNS: error sending ping -- %s\n", STRERROR);
     return FALSE;
   }
 
   /* read just first few bytes which contains enough information */
   if(socket_read(s, (unsigned char *)buf, 5) < 5) {
-    log("TNS: error receiving ping response -- %s\n", STRERROR);
+    LogError("TNS: error receiving ping response -- %s\n", STRERROR);
     return FALSE;
   }
 
   /* compare packet type */
   if(buf[4] != TNS_TYPE_REFUSED)
   {
-    log("TNS: invalid ping response\n");
+    LogError("TNS: invalid ping response\n");
     return FALSE;
   }
 
diff -Naur monit/sendmail.c monit-mp/sendmail.c
--- monit/sendmail.c    2006-04-19 05:34:36.951098000 +0200
+++ monit-mp/sendmail.c 2006-04-19 05:40:00.918179000 +0200
@@ -163,7 +163,7 @@
   va_end(ap);
   if (socket_write(S->socket, msg, strlen(msg)) <= 0) {
     FREE(msg);
-    log("Sendmail: error sending data to the server '%s' -- %s\n",
+    LogError("Sendmail: error sending data to the server '%s' -- %s\n",
        S->server, STRERROR);
     siglongjmp(S->error, TRUE);
   }
@@ -177,14 +177,14 @@
   char buf[STRLEN];
   
   if(!socket_readln(S->socket, buf, sizeof(buf))) {
-    log("Sendmail: error receiving data from the mailserver '%s' -- %s\n",
+    LogError("Sendmail: error receiving data from the mailserver '%s' -- %s\n",
        S->server, STRERROR);
     siglongjmp(S->error, TRUE);
   }
   Util_chomp(buf);
   sscanf(buf, "%d", &status);
   if(status >= 400) {
-    log("Sendmail error: %s\n", buf);
+    LogError("Sendmail error: %s\n", buf);
     siglongjmp(S->error, TRUE);
   }
 }
@@ -201,15 +201,15 @@
                          Run.mailserver_timeout);
     if(S->socket)
       break;
-    log("Cannot open a connection to the mailserver '%s:%i' -- %s\n",
+    LogError("Cannot open a connection to the mailserver '%s:%i' -- %s\n",
        S->server, S->port, STRERROR);
     if(mta && (mta= mta->next)) {
       S->server= mta->host;
       S->port=   mta->port;
-      log("Trying the next mail server '%s:%i'\n", S->server, S->port);
+      LogInfo("Trying the next mail server '%s:%i'\n", S->server, S->port);
       continue;
     } else {
-      log("No mail servers are available\n");
+      LogError("No mail servers are available\n");
       siglongjmp(S->error, TRUE);
     }
   } while(TRUE);
diff -Naur monit/spawn.c monit-mp/spawn.c
--- monit/spawn.c       2006-04-19 05:34:37.053901000 +0200
+++ monit-mp/spawn.c    2006-04-19 05:40:00.922237000 +0200
@@ -129,7 +129,7 @@
   ASSERT(C);
 
   if(access(C->arg[0], X_OK) != 0) {
-    log("Error: Could not execute %s\n", C->arg[0]);
+    LogError("Error: Could not execute %s\n", C->arg[0]);
     return;
   }
 
@@ -144,7 +144,7 @@
 
   pid= fork();
   if(pid < 0) {
-    log("Cannot fork a new process\n");  
+    LogError("Cannot fork a new process\n");  
     exit(1); 
   }
 
@@ -211,18 +211,18 @@
 
   /* Wait for first child - aka second parent, to exit */
   if(waitpid(pid, &stat_loc, 0) != pid) {
-      log("Waitpid error\n");
+      LogError("Waitpid error\n");
   }
 
   exit_status= WEXITSTATUS(stat_loc);
   if (exit_status & setgid_ERROR)
-    log("Failed to change gid to '%d' for '%s'\n", C->gid, C->arg[0]);
+    LogError("Failed to change gid to '%d' for '%s'\n", C->gid, C->arg[0]);
   if (exit_status & setuid_ERROR)
-    log("Failed to change uid to '%d' for '%s'\n", C->uid, C->arg[0]);
+    LogError("Failed to change uid to '%d' for '%s'\n", C->uid, C->arg[0]);
   if (exit_status & fork_ERROR)
-    log("Cannot fork a new process for '%s'\n", C->arg[0]);
+    LogError("Cannot fork a new process for '%s'\n", C->arg[0]);
   if (exit_status & redirect_ERROR)
-    log("Cannot redirect IO to /dev/null for '%s'\n", C->arg[0]);
+    LogError("Cannot redirect IO to /dev/null for '%s'\n", C->arg[0]);
 
   free_monit_environment(&environment);
   ASSERT(environment == NULL);
diff -Naur monit/ssl.c monit-mp/ssl.c
--- monit/ssl.c 2006-04-19 05:34:37.081649000 +0200
+++ monit-mp/ssl.c      2006-04-19 05:40:00.936208000 +0200
@@ -199,14 +199,14 @@
 
   } else {
 
-    log("%s: embed_ssl_socket (): Socket error!\n", prog);
+    LogError("%s: embed_ssl_socket (): Socket error!\n", prog);
     goto sslerror;
   }
 
   if ((ssl->handler= SSL_new (ssl->ctx)) == NULL ) {
 
     handle_ssl_error("embed_ssl_socket()");
-    log("%s: embed_ssl_socket (): Cannot initialize the SSL handler!\n", 
+    LogError("%s: embed_ssl_socket (): Cannot initialize the SSL handler!\n", 
          prog);
     goto sslerror;
 
@@ -217,7 +217,7 @@
   if((ssl->socket_bio= BIO_new_socket(ssl->socket, BIO_NOCLOSE)) == NULL) {
 
     handle_ssl_error("embed_ssl_socket()");
-    log("%s: embed_ssl_socket (): Cannot generate IO buffer!\n", prog);
+    LogError("%s: embed_ssl_socket (): Cannot generate IO buffer!\n", prog);
     goto sslerror;
 
   }
@@ -230,7 +230,7 @@
 
     if((time(NULL)-ssl_time) > SSL_TIMEOUT) {
 
-      log("%s: embed_ssl_socket (): SSL service timeout!\n",
+      LogError("%s: embed_ssl_socket (): SSL service timeout!\n",
            prog);
       goto sslerror;
     
@@ -255,7 +255,7 @@
 
   if (! update_ssl_cert_data(ssl)) {
 
-    log("%s: embed_ssl_socket (): Cannot get the SSL server certificate!\n", 
+    LogError("%s: embed_ssl_socket (): Cannot get the SSL server 
certificate!\n", 
          prog);
     goto sslerror;
 
@@ -378,7 +378,7 @@
 
   if((socket= create_socket(hostname, port, protocol, NET_TIMEOUT)) == -1) {
 
-    log("%s: create_ssl_socket(): Cannot connect!\n", prog);
+    LogError("%s: create_ssl_socket(): Cannot connect!\n", prog);
     goto sslerror;
 
   }
@@ -595,7 +595,8 @@
   if ((ssl_server->method= SSLv23_server_method()) == NULL ) {
 
     handle_ssl_error("init_ssl_server()");
-    log("%s: init_ssl_server (): Cannot initialize the SSL method!\n", prog);
+    LogError("%s: init_ssl_server (): Cannot initialize the SSL method!\n",
+      prog);
     goto sslerror;
 
   }
@@ -603,7 +604,7 @@
   if ((ssl_server->ctx= SSL_CTX_new(ssl_server->method)) == NULL ) {
 
     handle_ssl_error("init_ssl_server()");
-    log("%s: init_ssl_server (): Cannot initialize SSL server"
+    LogError("%s: init_ssl_server (): Cannot initialize SSL server"
          " certificate handler!\n"
          , prog);
     goto sslerror;
@@ -614,8 +615,8 @@
                                   SSL_FILETYPE_PEM) <= 0) {
 
     handle_ssl_error("init_ssl_server()");
-    log("%s: init_ssl_server(): Cannot initialize SSL server"
-         " certificate!\n", prog);
+    LogError("%s: init_ssl_server(): Cannot initialize SSL server"
+      " certificate!\n", prog);
     goto sslerror;
 
   }
@@ -624,7 +625,7 @@
                                  SSL_FILETYPE_PEM) <= 0) {
 
     handle_ssl_error("init_ssl_server()");
-    log("%s: init_ssl_server(): Cannot initialize SSL server" 
+    LogError("%s: init_ssl_server(): Cannot initialize SSL server" 
          " private key!\n", prog);
     goto sslerror;
 
@@ -633,7 +634,7 @@
   if (!SSL_CTX_check_private_key(ssl_server->ctx)) {
 
     handle_ssl_error("init_ssl_server()");
-    log("%s: init_ssl_server(): The private key does not match the"
+    LogError("%s: init_ssl_server(): The private key does not match the"
          " certificate public key!\n", prog);
     goto sslerror;
 
@@ -645,7 +646,7 @@
   if (!verify_init(ssl_server)) {
 
     handle_ssl_error("init_ssl_server()");
-    log("%s: init_ssl_server(): Verification engine was not"
+    LogError("%s: init_ssl_server(): Verification engine was not"
          " properly initialized!\n", prog);
     goto sslerror;
 
@@ -704,7 +705,7 @@
 
   if ((socket= create_server_socket(port, backlog, bindAddr)) == -1) {
 
-    log("%s: create_ssl_server_socket(): Cannot connect!\n", prog);
+    LogError("%s: create_ssl_server_socket(): Cannot connect!\n", prog);
     goto sslerror;
 
   }
@@ -1039,7 +1040,7 @@
   if((ssl->handler= SSL_new(ssl->ctx)) == NULL) { 
  
     handle_ssl_error("embed_accepted_ssl_socket()");
-    log("%s: embed_accepted_ssl_socket(): Cannot initialize the"
+    LogError("%s: embed_accepted_ssl_socket(): Cannot initialize the"
          " SSL handler!\n", prog); 
     goto sslerror;
 
@@ -1047,7 +1048,7 @@
 
   if(socket < 0) {
 
-    log("Socket error!\n");
+    LogError("Socket error!\n");
     goto sslerror;
 
   }
@@ -1057,7 +1058,7 @@
   if((ssl->socket_bio= BIO_new_socket(ssl->socket, BIO_NOCLOSE)) == NULL) {
 
     handle_ssl_error("embed_accepted_ssl_socket()");
-    log("%s: embed_accepted_ssl_socket(): Cannot generate IO buffer!\n", 
+    LogError("%s: embed_accepted_ssl_socket(): Cannot generate IO buffer!\n", 
          prog);
     goto sslerror;
 
@@ -1071,7 +1072,7 @@
 
     if((time(NULL)-ssl_time) > SSL_TIMEOUT) {
 
-      log("%s: embed_accepted_ssl_socket(): SSL service timeout!\n", 
+      LogError("%s: embed_accepted_ssl_socket(): SSL service timeout!\n", 
            prog);
       goto sslerror;
       
@@ -1096,7 +1097,7 @@
 
   if(!update_ssl_cert_data(ssl) && (ssl->clientpemfile != NULL)) {
 
-    log("%s: The client did not supply a required client certificate!\n", 
+    LogError("%s: The client did not supply a required client certificate!\n", 
          prog);
     goto sslerror;
 
@@ -1104,7 +1105,7 @@
 
   if (SSL_get_verify_result(ssl->handler)>0) {
 
-    log("%s: Verification of the certificate has failed!\n", 
+    LogError("%s: Verification of the certificate has failed!\n", 
          prog);
     goto sslerror;
 
@@ -1385,7 +1386,7 @@
 
   default:
 
-    log("%s: new_ssl_connection(): Unknown SSL version!\n", prog);
+    LogError("%s: new_ssl_connection(): Unknown SSL version!\n", prog);
     goto sslerror;
 
   }
@@ -1393,7 +1394,8 @@
   if (ssl->method == NULL ) {
 
     handle_ssl_error("new_ssl_connection()");
-    log("%s: new_ssl_connection(): Cannot initialize SSL method!\n", prog);
+    LogError("%s: new_ssl_connection(): Cannot initialize SSL method!\n",
+      prog);
     goto sslerror;
 
   } 
@@ -1401,8 +1403,8 @@
   if ((ssl->ctx= SSL_CTX_new (ssl->method)) == NULL ) {
 
     handle_ssl_error("new_ssl_connection()");
-    log("%s: new_ssl_connection(): Cannot initialize SSL server certificate"
-         " handler!\n", prog);
+    LogError("%s: new_ssl_connection(): Cannot initialize SSL server "
+      "certificate handler!\n", prog);
     goto sslerror;
 
   }
@@ -1413,7 +1415,7 @@
                                     SSL_FILETYPE_PEM) <= 0) {
 
       handle_ssl_error("new_ssl_connection()");
-      log("%s: new_ssl_connection(): Cannot initialize SSL server"
+      LogError("%s: new_ssl_connection(): Cannot initialize SSL server"
            " certificate!\n", prog);
       goto sslerror;
       
@@ -1423,7 +1425,7 @@
                                    SSL_FILETYPE_PEM) <= 0) {
 
       handle_ssl_error("new_ssl_connection()");
-      log("%s: new_ssl_connection(): Cannot initialize SSL server"
+      LogError("%s: new_ssl_connection(): Cannot initialize SSL server"
            " private key!\n", prog);
       goto sslerror;
 
@@ -1432,7 +1434,7 @@
     if (!SSL_CTX_check_private_key(ssl->ctx)) {
 
       handle_ssl_error("new_ssl_connection()");
-      log("%s: new_ssl_connection(): Private key does not match the"
+      LogError("%s: new_ssl_connection(): Private key does not match the"
            " certificate public key!\n", 
            prog);
       goto sslerror;
@@ -1546,7 +1548,7 @@
 
   if ( -1 == stat(ssl_server->clientpemfile, &stat_buf )) {
 
-    log("%s: verify_init(): Cannot stat the SSL pem path '%s' -- %s\n",
+    LogError("%s: verify_init(): Cannot stat the SSL pem path '%s' -- %s\n",
          prog, Run.httpsslclientpem, STRERROR);
 
     goto end_error;
@@ -1559,14 +1561,14 @@
                                       ssl_server->clientpemfile)) {
 
       handle_ssl_error("verify_init()");
-      log("%s: verify_init(): Error setting verify directory to %s\n", 
+      LogError("%s: verify_init(): Error setting verify directory to %s\n", 
            Run.httpsslclientpem);
 
       goto end_error;
 
     }
 
-    log("%s: verify_init(): Loaded SSL client pem directory '%s'\n", 
+    LogInfo("%s: verify_init(): Loaded SSL client pem directory '%s'\n", 
        prog, ssl_server->clientpemfile);
 
     /* Monits server cert for cli support ! */
@@ -1575,14 +1577,14 @@
                                      NULL)) {
 
       handle_ssl_error("verify_init()");
-      log("%s: verify_init(): Error loading verify certificates from %s\n",
+      LogError("%s: verify_init(): Error loading verify certificates from 
%s\n",
            prog, ssl_server->pemfile);
 
       goto end_error;
 
     }
 
-    log("%s: verify_init(): Loaded monit's SSL pem server file '%s'\n", 
+    LogInfo("%s: verify_init(): Loaded monit's SSL pem server file '%s'\n", 
        prog, ssl_server->pemfile);
 
   } else if (S_ISREG(stat_buf.st_mode)) {
@@ -1592,14 +1594,14 @@
                                      NULL)) {
 
       handle_ssl_error("verify_init()");
-      log("%s: verify_init(): Error loading verify certificates from %s\n",
+      LogError("%s: verify_init(): Error loading verify certificates from 
%s\n",
            prog, Run.httpsslclientpem);
 
       goto end_error;
 
     }
 
-    log("%s: verify_init(): Loaded SSL pem client file '%s'\n", 
+    LogInfo("%s: verify_init(): Loaded SSL pem client file '%s'\n", 
        prog, ssl_server->clientpemfile);
 
     /* Monits server cert for cli support ! */
@@ -1608,14 +1610,14 @@
                                      NULL)) {
 
       handle_ssl_error("verify_init()");
-      log("%s: verify_init(): Error loading verify certificates from %s\n",
+      LogError("%s: verify_init(): Error loading verify certificates from 
%s\n",
            prog, ssl_server->pemfile);
 
       goto end_error;
 
     }
 
-    log("%s: verify_init(): Loaded monit's SSL pem server file '%s'\n", 
+    LogInfo("%s: verify_init(): Loaded monit's SSL pem server file '%s'\n", 
        prog, ssl_server->pemfile);
 
     SSL_CTX_set_client_CA_list(ssl_server->ctx,
@@ -1623,7 +1625,7 @@
 
   } else {
 
-    log("%s: verify_init(): SSL client pem path is no file or directory %s\n",
+    LogError("%s: verify_init(): SSL client pem path is no file or directory 
%s\n",
          prog, ssl_server->clientpemfile);
 
     goto end_error;
@@ -1671,7 +1673,7 @@
                               &found_cert)!=1) {
 
     handle_ssl_error("verify_callback()");
-    log("%s: verify_callback(): SSL connection rejected. No matching "
+    LogError("%s: verify_callback(): SSL connection rejected. No matching "
          "certificate found.", prog);
 
     goto reject; 
@@ -1726,7 +1728,7 @@
 
     /* Remote site specified a certificate, but it's not correct */
     
-    log("%s: check_preverify(): SSL connection rejected because"
+    LogError("%s: check_preverify(): SSL connection rejected because"
          " certificate verification has failed -- Error %i\n", 
          prog, ctx->error);
     return FALSE; /* Reject connection */
@@ -1739,7 +1741,7 @@
     
     /* Let's accept self signed certs for the moment! */
     
-    log("%s: check_preverify(): SSL connection accepted with"
+    LogInfo("%s: check_preverify(): SSL connection accepted with"
        " self signed certificate!\n", prog);
 
     ctx->error=0;
@@ -1752,7 +1754,7 @@
     
     /* Let's accept any purpose certs for the moment! */
     
-    log("%s: check_preverify(): SSL connection accepted "
+    LogInfo("%s: check_preverify(): SSL connection accepted "
        "with invalid purpose!\n", prog);
 
     ctx->error=0;
@@ -1760,7 +1762,7 @@
 
   } 
     
-  log("%s: check_preverify(): SSL connection rejected because "
+  LogError("%s: check_preverify(): SSL connection rejected because "
        "certificate verification has failed -- Error %i!\n", 
        prog, ctx->error);
   return FALSE; /* Reject connection */
@@ -1776,7 +1778,7 @@
   STACK_OF(X509_NAME) *stack;
   
   stack=SSL_CTX_get_client_CA_list(ssl_server->ctx);
-  log("%s: verify_info(): Found %d client certificates\n", prog, 
+  LogInfo("%s: verify_info(): Found %d client certificates\n", prog, 
       sk_X509_NAME_num(stack));
   
 }
@@ -1900,18 +1902,18 @@
       if (can_read(ssl->socket, timeout))
           return TRUE;
       else
-          log("%s: %s: Openssl read timeout error!\n", prog, operation);
+          LogError("%s: %s: Openssl read timeout error!\n", prog, operation);
           return FALSE;
       
   case SSL_ERROR_WANT_WRITE:
       if (can_read(ssl->socket, timeout))
           return TRUE;
       else
-          log("%s: %s: Openssl write timeout error!\n", prog, operation);
+          LogError("%s: %s: Openssl write timeout error!\n", prog, operation);
           return FALSE;
     
   case SSL_ERROR_SYSCALL:
-    log("%s: %s: Openssl syscall error: %s!\n", prog, operation, 
+    LogError("%s: %s: Openssl syscall error: %s!\n", prog, operation, 
          STRERROR);
     return FALSE;
 
@@ -1920,7 +1922,7 @@
     return FALSE;
       
   default:
-    log("%s: %s: Openssl error!\n", prog, operation);
+    LogError("%s: %s: Openssl error!\n", prog, operation);
 
   }
 
@@ -1933,7 +1935,7 @@
  */
 static void handle_ssl_error(char *operation) {
 
-  log("%s: %s: Openssl engine error: %s\n", prog, operation, SSLERROR);
+  LogError("%s: %s: Openssl engine error: %s\n", prog, operation, SSLERROR);
 
 }
 
diff -Naur monit/state.c monit-mp/state.c
--- monit/state.c       2006-04-19 05:34:37.194327000 +0200
+++ monit-mp/state.c    2006-04-19 05:40:00.940805000 +0200
@@ -117,7 +117,7 @@
   l= Util_getNumberOfServices();
   
   if(fwrite(&l, 1, sizeof (int), S) != sizeof(int)) {
-    log("%s: Unable to save monit state information to '%s'\n",
+    LogError("%s: Unable to save monit state information to '%s'\n",
        prog, Run.statefile);
     goto error;
   }
@@ -125,7 +125,7 @@
   for(s= servicelist; s; s= s->next) {
     clone_state(s, &state);
     if(fwrite(&state, 1, sizeof(State_T), S) != sizeof(State_T)) {
-      log("%s: An error occured when saving monit state information "
+      LogError("%s: An error occured when saving monit state information "
          "for the service %s\n", prog, s->name);
       goto error;
     }
@@ -196,7 +196,7 @@
 
   errno= 0;
   if(fread(&l, 1, sizeof (int), S) != sizeof(int)) {
-    log("%s: Unable to read monit state information from '%s'\n",
+    LogError("%s: Unable to read monit state information from '%s'\n",
        prog, Run.statefile);
     has_error= TRUE;
     goto error;
@@ -205,7 +205,7 @@
   if(l > 0) {
     for(i=0; i<l; i++) {
       if(fread(&s, 1, sizeof(State_T), S) != sizeof(State_T)) {
-       log("%s: An error occured when updating monit state information\n",
+       LogError("%s: An error occured when updating monit state information\n",
            prog);
        has_error= TRUE;
        goto error;
@@ -238,7 +238,7 @@
   umask(MYPIDMASK);
   
   if((S= fopen(Run.statefile, mode)) == NULL) {
-    log("%s: Cannot open the monit state file '%s' -- %s\n",
+    LogError("%s: Cannot open the monit state file '%s' -- %s\n",
        prog, Run.statefile, STRERROR);
     
     return NULL;
diff -Naur monit/status.c monit-mp/status.c
--- monit/status.c      2006-04-19 05:34:37.196840000 +0200
+++ monit-mp/status.c   2006-04-19 05:40:00.943742000 +0200
@@ -82,13 +82,14 @@
   char *auth= NULL;
 
   if(!exist_daemon()) {
-    log("%s: no status available -- the monit daemon is not running\n", prog);
+    LogError("%s: no status available -- the monit daemon is not running\n",
+      prog);
     return status;
   }
 
   if(!(sock= socket_new(Run.bind_addr?Run.bind_addr:"localhost", Run.httpdport,
                         SOCKET_TCP, Run.httpdssl, NET_TIMEOUT))) {
-    log("%s: error connecting to the monit daemon\n", prog);
+    LogError("%s: error connecting to the monit daemon\n", prog);
     return status;
   }
 
@@ -107,7 +108,7 @@
   }
 
   if(!status) {
-    log("%s: cannot read status from the monit daemon\n", prog);
+    LogError("%s: cannot read status from the monit daemon\n", prog);
   } else {
     while(socket_readln(sock, buf, LINE)) {
       printf("%s", buf);
diff -Naur monit/util.c monit-mp/util.c
--- monit/util.c        2006-04-19 05:34:37.325677000 +0200
+++ monit-mp/util.c     2006-04-19 05:40:00.956291000 +0200
@@ -1168,18 +1168,18 @@
     return FALSE;
   }
   if(! File_isFile(pidfile)) {
-    log("%s: pidfile '%s' is not a regular file\n",prog, pidfile);
+    LogError("%s: pidfile '%s' is not a regular file\n",prog, pidfile);
     return FALSE;
   }
   if((file= fopen(pidfile,"r")) == (FILE *)NULL) {
-    log("%s: Error opening the pidfile '%s' -- %s\n",
+    LogError("%s: Error opening the pidfile '%s' -- %s\n",
        prog, pidfile, STRERROR);
     return FALSE ;
   }
   fscanf(file, "%d", &pid);
   fclose(file);
   if(pid == -1) {
-    log("%s: pidfile `%s' does not contain a valid pidnumber\n",
+    LogError("%s: pidfile `%s' does not contain a valid pidnumber\n",
        prog, pidfile);
     return (FALSE);
   }
@@ -1433,7 +1433,7 @@
              c->uname,
              c->passwd);
     if(! (b64= encode_base64(strlen(buf), (unsigned char *)buf)) ) {
-      log("Failed to base64 encode authentication header\n");
+      LogError("Failed to base64 encode authentication header\n");
       FREE(b64);
       return NULL;
     }
@@ -1443,7 +1443,7 @@
     return auth;
   }
 
-  log("Cleattext credentials needed for basic authorization!\n");
+  LogError("Cleattext credentials needed for basic authorization!\n");
   return NULL;
 
 }
@@ -1525,7 +1525,8 @@
   int i;
   for(i= 0; i < 3; i++) {
     if(close(i) == -1 || open("/dev/null", O_RDWR) != i) {
-      log("Cannot reopen standard file descriptor (%d) -- %s\n", i, STRERROR);
+      LogError("Cannot reopen standard file descriptor (%d) -- %s\n",
+        i, STRERROR);
     }
   }
 }
@@ -1604,7 +1605,7 @@
       ASSERT(temp);
       *temp= '\0';
       if (md5_crypt(outside, id, salt, outside_crypt, STRLEN) == NULL) {
-       log("Cannot generate MD5 digest error.\n");
+       LogError("Cannot generate MD5 digest error.\n");
        return FALSE;
       }
       break;
@@ -1619,7 +1620,7 @@
       break;
     }
   default:
-    log("Unknown password digestion method.\n");
+    LogError("Unknown password digestion method.\n");
     return FALSE;
   }
 
@@ -1778,7 +1779,7 @@
          return TRUE;
       break;
   default:
-      log("Unknown comparison operator\n");
+      LogError("Unknown comparison operator\n");
       return FALSE;
   }
 
diff -Naur monit/validate.c monit-mp/validate.c
--- monit/validate.c    2006-04-19 05:34:37.473218000 +0200
+++ monit-mp/validate.c 2006-04-19 05:40:00.963455000 +0200
@@ -200,7 +200,7 @@
         check_process_resources(s, pr);
       }
     } else {
-      log("'%s' failed to get service data\n", s->name);
+      LogError("'%s' failed to get service data\n", s->name);
     }
 
   }
@@ -481,7 +481,8 @@
         break;
 
       default:
-        log("'%s' error -- unknown ICMP type: [%d]\n", s->name, icmp->type);
+        LogError("'%s' error -- unknown ICMP type: [%d]\n",
+          s->name, icmp->type);
         return FALSE;
 
       }
@@ -870,7 +871,8 @@
     break;
 
   default:
-    log("'%s' error -- unknown resource ID: [%d]\n", s->name, r->resource_id);
+    LogError("'%s' error -- unknown resource ID: [%d]\n",
+      s->name, r->resource_id);
     return;
   }
 
@@ -912,7 +914,7 @@
         changed= strncmp(cs->hash, s->inf->cs_sum, 40);
         break;
       default:
-        log("'%s' unknown hash type\n", s->name);
+        LogError("'%s' unknown hash type\n", s->name);
         FREE(s->inf->cs_sum);
         return;
     }
@@ -1324,7 +1326,7 @@
   ASSERT(s && td);
 
   if( (td->limit_percent < 0) && (td->limit_absolute < 0) ) {
-    log("'%s' error: device limit not set\n", s->name);
+    LogError("'%s' error: device limit not set\n", s->name);
     return;
   }
 
@@ -1393,7 +1395,8 @@
       return;
       
   default:
-      log("'%s' error -- unknown resource type: [%d]\n", s->name, 
td->resource);
+      LogError("'%s' error -- unknown resource type: [%d]\n", s->name,
+        td->resource);
       return;
   }
   
diff -Naur monit/xmalloc.c monit-mp/xmalloc.c
--- monit/xmalloc.c     2006-04-19 05:34:37.477393000 +0200
+++ monit-mp/xmalloc.c  2006-04-19 05:40:00.967812000 +0200
@@ -69,7 +69,7 @@
 #if ! HAVE_MALLOC
     if ( n == 0) {
 
-      log("%s: passed a broken malloc 0\n", prog);
+      LogError("%s: passed a broken malloc 0\n", prog);
       exit(1);
 
     }
@@ -77,7 +77,7 @@
 
     if ( p == NULL ) {
       
-      log("%s: malloc failed -- %s\n", prog, STRERROR);
+      LogError("%s: malloc failed -- %s\n", prog, STRERROR);
       exit(1);
       
     }
@@ -93,7 +93,7 @@
     p= (void *)calloc(count, nbytes);
     if ( p == NULL ) {
       
-      log("%s: malloc failed -- %s\n", prog, STRERROR);
+      LogError("%s: malloc failed -- %s\n", prog, STRERROR);
       exit(1);
       
     }
@@ -143,7 +143,7 @@
   p= realloc(p, nbytes);
   if(p == NULL) {
     
-    log("%s: realloc failed -- %s\n", prog, STRERROR);
+    LogError("%s: realloc failed -- %s\n", prog, STRERROR);
     exit(1);
     
   }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]