monit-dev
[Top][All Lists]
Advanced

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

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


From: Martin Pala
Subject: [Fwd: Bug#353758: monit: suboptimal logging reduces usefulness]
Date: Mon, 20 Feb 2006 21:17:15 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060205 Debian/1.7.12-1.1

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.

-- 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

diff -ruN monit-4.5/alert.c monit-4.5.mine/alert.c
--- monit-4.5/alert.c   2005-02-13 01:00:13.000000000 +0100
+++ monit-4.5.mine/alert.c      2006-02-15 15:19:30.971995888 +0100
@@ -115,7 +115,7 @@
        tmp->next= list;
        list= tmp;
 
-       DEBUG("%s notification is sent to %s\n", EVENT_DESCRIPTION(E), m->to);
+       DEBUG(LOG_DEBUG, "%s notification is sent to %s\n", 
EVENT_DESCRIPTION(E), m->to);
 
       }
 
@@ -156,7 +156,7 @@
        tmp->next= list;
        list= tmp;
 
-       DEBUG("%s notification is sent to %s\n", EVENT_DESCRIPTION(E), m->to);
+       DEBUG(LOG_DEBUG, "%s notification is sent to %s\n", 
EVENT_DESCRIPTION(E), m->to);
 
       }
 
diff -ruN monit-4.5/collector.c monit-4.5.mine/collector.c
--- monit-4.5/collector.c       2005-02-20 00:52:18.000000000 +0100
+++ monit-4.5.mine/collector.c  2006-02-15 15:19:30.987993456 +0100
@@ -36,6 +36,10 @@
 #include <errno.h>
 #endif 
 
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
 #include "monitor.h"
 #include "socket.h"
 
@@ -83,17 +87,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",
+    log(LOG_ERR, "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);
+      log(LOG_ERR, "Collector: trying next server %s\n", C->url->url);
       continue;
     }
     else
     {
-      log("Collector: no server available -- aborting message\n");
+      log(LOG_ERR, "Collector: no server available -- aborting message\n");
       /* FIXME: Add message to a queue for later retry */
       goto exit2;
     }
@@ -103,17 +107,17 @@
 
   if(!data_send(C, D))
   {
-    log("Collector: communication failure -- aborting message\n");
+    log(LOG_ERR, "Collector: communication failure -- aborting message\n");
     /* FIXME: Try other collector or add message to a queue for later retry */
     goto exit1;
   }
   if(!data_check(C))
   {
-    log("Collector: communication failure -- aborting message\n");
+    log(LOG_ERR, "Collector: communication failure -- aborting message\n");
     /* FIXME: Try other collector or add message to a queue for later retry */
     goto exit1;
   }
-  DEBUG("Collector: %s message send to %s\n", E?"event":"status", C->url->url);
+  DEBUG(LOG_DEBUG, "Collector: %s message send to %s\n", E?"event":"status", 
C->url->url);
 
 exit1:
   FREE(D);
@@ -162,7 +166,7 @@
   FREE(auth);
   if(rv <0)
   {
-    log("Collector: error sending data to %s -- %s\n", C->url->url, STRERROR);
+    log(LOG_ERR, "Collector: error sending data to %s -- %s\n", C->url->url, 
STRERROR);
     return FALSE;
   }
   return TRUE;
@@ -181,14 +185,14 @@
   char buf[STRLEN];
 
   if(!socket_readln(C->socket, buf, sizeof(buf))) {
-    log("Collector: error receiving data from %s -- %s\n", 
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "Collector: message sending failed to %s -- %s\n", 
C->url->url, buf);
     return FALSE;
   }
   return TRUE;
diff -ruN monit-4.5/control.c monit-4.5.mine/control.c
--- monit-4.5/control.c 2005-03-15 00:11:46.000000000 +0100
+++ monit-4.5.mine/control.c    2006-02-15 15:19:30.972995736 +0100
@@ -101,7 +101,7 @@
   
   if(!s) {
     
-    log("%s: Cannot connect to the monit daemon. "
+    log(LOG_ERR, "%s: Cannot connect to the monit daemon. "
           "Did you start it with http support?\n", prog);
     goto error;
     
@@ -133,7 +133,7 @@
   ASSERT(action);
 
   if(!(s= Util_getService(S))) {
-    log("%s: Cannot %s service '%s' -- not found in %s\n",
+    log(LOG_ERR, "%s: Cannot %s service '%s' -- not found in %s\n",
           prog, action, S, Run.controlfile);
     return;
   }
@@ -141,13 +141,13 @@
   if(IS(action, "start")) {
     
     if(s->type==TYPE_PROCESS && Util_isProcessRunning(s)) {
-      DEBUG("%s: Process already running -- process %s\n", prog, S);
+      DEBUG(LOG_DEBUG, "%s: Process already running -- process %s\n", prog, S);
       monitor_set(s);
       return;
     }
     
     if(s->type==TYPE_PROCESS && !s->start) {
-      DEBUG("%s: Start method not defined -- process %s\n", prog, S);
+      DEBUG(LOG_DEBUG, "%s: Start method not defined -- process %s\n", prog, 
S);
       monitor_set(s);
       return;
     }
@@ -159,7 +159,7 @@
   } else if(IS(action, "stop")) {
     
     if(s->type==TYPE_PROCESS && !s->stop) {
-      DEBUG("%s: Stop method not defined -- process %s\n", prog, S);
+      DEBUG(LOG_DEBUG, "%s: Stop method not defined -- process %s\n", prog, S);
       Util_monitorUnset(s);
       return;
     }
@@ -170,11 +170,11 @@
   } else if(IS(action, "restart")) {
     
     if(s->type==TYPE_PROCESS && (!s->start || !s->stop)) {
-      DEBUG("%s: Start or stop method not defined -- process %s\n", prog, S);
+      DEBUG(LOG_DEBUG, "%s: Start or stop method not defined -- process %s\n", 
prog, S);
       monitor_set(s);
       return;
     } else {
-      log("'%s' trying to restart\n", s->name);
+      log(LOG_INFO, "'%s' trying to restart\n", s->name);
     }
     
     do_depend(s, "stop");
@@ -253,7 +253,7 @@
     int status;
     pthread_t thread;
 
-    log("'%s' start: %s\n", s->name, s->start->arg[0]);
+    log(LOG_INFO, "'%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
@@ -266,7 +266,7 @@
         LOCK(Run.mutex)
           Run.wait_start--;
         END_LOCK;
-       log("Warning: Failed to create the start controller thread. "
+       log(LOG_WARNING, "Warning: Failed to create the start controller 
thread. "
            "Thread error -- %s.\n", strerror(status));
       }
     }
@@ -294,7 +294,7 @@
   Util_monitorUnset(s);
 
   if(s->stop && (s->type!=TYPE_PROCESS || Util_isProcessRunning(s))) {
-    log("'%s' stop: %s\n", s->name, s->stop->arg[0]);
+    log(LOG_INFO, "'%s' stop: %s\n", s->name, s->stop->arg[0]);
     spawn(s, s->stop, "Stopped");
 
     if(s->type==TYPE_PROCESS) {
@@ -369,7 +369,7 @@
 
   if(!s->monitor) {
     s->monitor= MONITOR_INIT;
-    DEBUG("Monitoring enabled -- service %s\n", s->name);
+    DEBUG(LOG_DEBUG, "Monitoring enabled -- service %s\n", s->name);
   }
 
 }
diff -ruN monit-4.5/daemonize.c monit-4.5.mine/daemonize.c
--- monit-4.5/daemonize.c       2005-01-06 21:51:49.000000000 +0100
+++ monit-4.5.mine/daemonize.c  2006-02-15 15:19:30.972995736 +0100
@@ -56,6 +56,10 @@
 #include <string.h>
 #endif
 
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
 #include "monitor.h"
 
 
@@ -92,7 +96,7 @@
    */
   if((pid= fork ()) < 0) {
     
-    log("Cannot fork of a new process\n");  
+    log(LOG_ERR, "Cannot fork of a new process\n");  
     exit (1);
     
   }  
@@ -106,7 +110,7 @@
 
   if((pid= fork ()) < 0) {
     
-    log("Cannot fork of a new process\n");  
+    log(LOG_ERR, "Cannot fork of a new process\n");  
     exit (1);
     
   }  
@@ -123,7 +127,7 @@
    */
   if(chdir("/") < 0) {
     
-    log("Cannot chdir to / -- %s\n", STRERROR);
+    log(LOG_ERR, "Cannot chdir to / -- %s\n", STRERROR);
     exit(1);
     
   }
@@ -150,14 +154,14 @@
     
     if ( kill(pid, sig) < 0 ) {
       
-      log("%s: Cannot send signal to daemon process -- %s\n",prog, STRERROR);
+      log(LOG_ERR, "%s: Cannot send signal to daemon process -- %s\n",prog, 
STRERROR);
       return FALSE;
       
     }
     
   } else {
     
-    log("%s: No daemon process found\n", prog);
+    log(LOG_ERR, "%s: No daemon process found\n", prog);
     return TRUE;
     
   }
diff -ruN monit-4.5/debian/patches/config_file_relocation-2.patch 
monit-4.5.mine/debian/patches/config_file_relocation-2.patch
--- monit-4.5/debian/patches/config_file_relocation-2.patch     2006-02-20 
10:46:20.384761448 +0100
+++ monit-4.5.mine/debian/patches/config_file_relocation-2.patch        
2006-02-15 15:19:30.988993304 +0100
@@ -40,7 +40,7 @@
 @@ -170,8 +175,8 @@
      return (rcfile);
    }
-   log("%s: Cannot find the control file at "
+   log(LOG_ERR, "%s: Cannot find the control file at "
 -      "~/.%s, /etc/%s, /usr/local/etc/%s or at ./%s \n",
 -      prog, MONITRC, MONITRC, MONITRC, MONITRC);
 +      "~/.%s, /etc/monit/%s, /etc/%s, /usr/local/etc/%s or at ./%s \n",
diff -ruN monit-4.5/debian/rules monit-4.5.mine/debian/rules
--- monit-4.5/debian/rules      2006-02-20 10:46:20.387760992 +0100
+++ monit-4.5.mine/debian/rules 2006-02-15 15:19:30.989993152 +0100
@@ -7,7 +7,7 @@
 # in *addition* to what autotools.mk does normally.  So the end command
 # will look something like:
 # ./configure --prefix=/usr/ --sysconfdir=/etc ... --options-below...
-DEB_CONFIGURE_EXTRA_FLAGS := --bindir=/usr/sbin --without-accurate-mem-calcs
+DEB_CONFIGURE_EXTRA_FLAGS := --bindir=/usr/sbin --without-accurate-mem-calcs 
CFLAGS='-Werror'
 
 # Install examples
 #DEB_INSTALL_EXAMPLES_monit := debian/example.monitrc 
diff -ruN monit-4.5/device/device_common.c monit-4.5.mine/device/device_common.c
--- monit-4.5/device/device_common.c    2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/device/device_common.c       2006-02-15 15:19:30.980994520 
+0100
@@ -87,7 +87,7 @@
   ASSERT(object);
 
   if(stat(object, &buf) != 0) {
-    log("%s: Cannot stat '%s' -- %s\n", prog, object, STRERROR);
+    log(LOG_ERR, "%s: Cannot stat '%s' -- %s\n", prog, object, STRERROR);
     return NULL;
   }
 
@@ -101,7 +101,7 @@
 
   }
 
-  log("%s: Not file, directory or block special device: '%s'", prog, object);
+  log(LOG_ERR, "%s: Not file, directory or block special device: '%s'", prog, 
object);
 
   return NULL;
 
diff -ruN monit-4.5/device/sysdep_LINUX.c monit-4.5.mine/device/sysdep_LINUX.c
--- monit-4.5/device/sysdep_LINUX.c     2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/device/sysdep_LINUX.c        2006-02-15 15:19:30.981994368 
+0100
@@ -77,7 +77,7 @@
 
 
   if((mntfd= setmntent("/etc/mtab", "r")) == NULL) {
-    log("%s: Cannot open /etc/mtab file", prog);
+    log(LOG_ERR, "%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",
+    log(LOG_ERR, "%s: Error getting usage statistics for device '%s' -- %s\n",
         prog, inf->mntpath, STRERROR);
     return FALSE;
   }
diff -ruN monit-4.5/env.c monit-4.5.mine/env.c
--- monit-4.5/env.c     2005-01-06 21:51:49.000000000 +0100
+++ monit-4.5.mine/env.c        2006-02-15 15:19:30.972995736 +0100
@@ -148,7 +148,7 @@
   
   if(putenv(path)) {
     
-    log("%s: cannot set the PATH variable -- %s\n", prog, STRERROR);
+    log(LOG_ERR, "%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);
+      log(LOG_ERR, "Cannot open /dev/null -- %s\n", STRERROR);
       exit(1);
       
     }
@@ -185,7 +185,7 @@
   /* Get password struct */
   if ( ! (pw= getpwuid(geteuid())) ) {
     
-    log("%s: You don't exist. Go away.\n", prog);
+    log(LOG_ERR, "%s: You don't exist. Go away.\n", prog);
     exit(1);
     
   }
@@ -193,7 +193,7 @@
   /* Get CWD */
   if ( ! (getcwd(cwd, sizeof(cwd))) ) {
     
-    log("%s: Cannot read current directory -- %s\n", prog, STRERROR);
+    log(LOG_ERR, "%s: Cannot read current directory -- %s\n", prog, STRERROR);
     exit(1);
     
   }
diff -ruN monit-4.5/event.c monit-4.5.mine/event.c
--- monit-4.5/event.c   2005-01-06 21:51:49.000000000 +0100
+++ monit-4.5.mine/event.c      2006-02-15 15:29:13.004513496 +0100
@@ -369,7 +369,7 @@
 
   if(E->message)
   {
-    log("%s\n", E->message);
+    log(LOG_ALERT, "%s\n", E->message);
   }
 
   if(E->state)
@@ -447,7 +447,7 @@
       return FALSE;
 
   default:
-      log("'%s' error -- unknown failure action: [%d]\n", E->source->name,
+      log(LOG_ERR, "'%s' error -- unknown failure action: [%d]\n", 
E->source->name,
         A->id);
       break;
 
diff -ruN monit-4.5/file.c monit-4.5.mine/file.c
--- monit-4.5/file.c    2005-01-28 21:19:14.000000000 +0100
+++ monit-4.5.mine/file.c       2006-02-20 10:46:52.243918120 +0100
@@ -130,7 +130,7 @@
        ) {
       return MAX(buf.st_mtime, buf.st_ctime);
     } else {
-      log("%s: Invalid object type - %s\n", prog, object);
+      log(LOG_ERR, "%s: Invalid object type - %s\n", prog, object);
     }
   }
 
@@ -169,7 +169,7 @@
     snprintf(rcfile, STRLEN, "%s/%s", Run.Env.cwd, MONITRC);
     return (rcfile);
   }
-  log("%s: Cannot find the control file at "
+  log(LOG_ERR, "%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);
@@ -192,7 +192,7 @@
   umask(MYPIDMASK);
   unlink(pidfile);
   if ((F= fopen(pidfile,"w")) == (FILE *)NULL) {
-    log("%s: Error opening pidfile '%s' for writing -- %s\n",
+    log(LOG_ERR, "%s: Error opening pidfile '%s' for writing -- %s\n",
        prog, pidfile, STRERROR);
     return(FALSE);
   }
@@ -255,22 +255,22 @@
   ASSERT(description);
 
   if(lstat(filename, &buf) < 0) {
-    log("%s: Cannot stat the %s '%s' -- %s\n",
+    log(LOG_ERR, "%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",
+    log(LOG_ERR, "%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", 
+    log(LOG_ERR, "%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", 
+    log(LOG_ERR, "%s: The %s '%s' must be owned by you.\n", 
        prog, description, filename);
     return FALSE;
   }
@@ -284,7 +284,7 @@
            () & ~permmask ->      We check if there are any other
                                   permissions set than in permmask 
     */
-    log("%s: The %s '%s' must have permissions no more "
+    log(LOG_ERR, "%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, 
diff -ruN monit-4.5/http/engine.c monit-4.5.mine/http/engine.c
--- monit-4.5/http/engine.c     2005-02-16 23:51:14.000000000 +0100
+++ monit-4.5.mine/http/engine.c        2006-02-15 15:19:30.981994368 +0100
@@ -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",
+    log(LOG_ERR, "http server: Could not create a server socket at port %d -- 
%s\n",
        port, STRERROR);
     
-    log("monit HTTP server not available\n");
+    log(LOG_INFO, "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");
+       log(LOG_ERR, "http server: Could not initialize SSL engine\n");
        
-       log("monit HTTP server not available\n");
+       log(LOG_INFO, "monit HTTP server not available\n");
        
        return;
       }
@@ -236,7 +236,7 @@
 
   if(! (hp= gethostbyname(name))) {
     
-    log("%s: Error: hostname did not resolve '%s'.\n",
+    log(LOG_ERR, "%s: Error: hostname did not resolve '%s'.\n",
           prog, name); 
     return FALSE;
     
@@ -262,7 +262,7 @@
         for(n= p= hostlist; p; n= p, p= p->next) {
 
           if((p->network == h->network) && ((p->mask == h->mask))) {
-            DEBUG("%s: Debug: Skipping redundant host '%s' (%s).\n",
+            DEBUG(LOG_DEBUG, "%s: Debug: Skipping redundant host '%s' (%s).\n",
                   prog, name, inet_ntoa(*(struct in_addr *) &h->network)); 
 
             destroy_host_allow(h);
@@ -272,14 +272,14 @@
        
         }
 
-        DEBUG("%s: Debug: Adding host allow '%s' (%s).\n",
+        DEBUG(LOG_DEBUG,"%s: Debug: Adding host allow '%s' (%s).\n",
               prog, name, inet_ntoa(*(struct in_addr *) &h->network)); 
         
         n->next= h;
       
       } else {
       
-        DEBUG("%s: Debug: Adding host allow '%s' (%s).\n",
+        DEBUG(LOG_DEBUG,"%s: Debug: Adding host allow '%s' (%s).\n",
               prog, name, inet_ntoa(*(struct in_addr *) &h->network));
         
         hostlist= h;
@@ -335,7 +335,7 @@
       
       if((p->network == net.network) && ((p->mask == net.mask))) {
        
-        DEBUG("%s: Debug: Skipping redundant net '%s'.\n",
+        DEBUG(LOG_DEBUG,"%s: Debug: Skipping redundant net '%s'.\n",
               prog, s_network); 
         destroy_host_allow(h);
         goto done;
@@ -344,14 +344,14 @@
       
     }
 
-    DEBUG("%s: Debug: Adding net allow '%s'.\n",
+    DEBUG(LOG_DEBUG,"%s: Debug: Adding net allow '%s'.\n",
           prog, s_network); 
     
     n->next= h;
     
   } else {
     
-    DEBUG("%s: Debug: Adding net allow '%s'.\n",
+    DEBUG(LOG_DEBUG,"%s: Debug: Adding net allow '%s'.\n",
           prog, s_network); 
 
     hostlist= h;
@@ -422,7 +422,7 @@
 
   if((Impl.doGet == 0) || (Impl.doPost == 0)) {
     
-    log("http server: Service Methods not implemented\n");
+    log(LOG_ERR, "http server: Service Methods not implemented\n");
     _exit(1);
     
   }
@@ -449,7 +449,7 @@
 
   }
 
-  log("%s: Denied connection from non-authorized client [%s]\n", prog,
+  log(LOG_INFO, "%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");
+        log(LOG_INFO, "http server: service stopped\n");
       }  else {
-        log("http server: cannot accept connection -- %s\n", STRERROR);
+        log(LOG_INFO, "http server: cannot accept connection -- %s\n", 
STRERROR);
       }
 
       return NULL;
diff -ruN monit-4.5/http/processor.c monit-4.5.mine/http/processor.c
--- monit-4.5/http/processor.c  2005-02-21 23:35:25.000000000 +0100
+++ monit-4.5.mine/http/processor.c     2006-02-15 15:19:30.982994216 +0100
@@ -781,13 +781,13 @@
   }
   /* Check if user exist */
   if(NULL==Util_getUserCredentials(uname)) {
-    log("Warning: Client '%s' supplied unknown user '%s'"
+    log(LOG_WARNING, "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'"
+    log(LOG_WARNING, "Warning: Client '%s' supplied wrong password for user 
'%s'"
        " accessing monit httpd\n", socket_get_remote_host(req->S), uname); 
     return FALSE;
   }
diff -ruN monit-4.5/http.c monit-4.5.mine/http.c
--- monit-4.5/http.c    2005-02-16 23:32:33.000000000 +0100
+++ monit-4.5.mine/http.c       2006-02-15 15:19:30.973995584 +0100
@@ -88,7 +88,7 @@
     
     if(! has_hosts_allow() && ! Run.credentials) {
       
-      log("%s: monit httpd not started since no connect allowed\n",
+      log(LOG_INFO, "%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);
+    log(LOG_INFO, "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",
+      log(LOG_ERR, "%s: Failed to stop the http server. Thread error -- %s.\n",
           prog, strerror(status));
     } else {
-      log("%s HTTP server stopped\n", prog);
+      log(LOG_INFO, "%s HTTP server stopped\n", prog);
     }
     break;
 
   case START_HTTP:
-    log("Starting %s HTTP server at [%s:%d]\n",
+    log(LOG_INFO, "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",
+      log(LOG_ERR, "%s: Failed to create the http server. Thread error -- 
%s.\n",
           prog, strerror(status));
     } else {
-      log("%s HTTP server started\n", prog);
+      log(LOG_INFO, "%s HTTP server started\n", prog);
     }
     break;
 
   default:
-    log("%s: Unknown http server action\n", prog);
+    log(LOG_ERR, "%s: Unknown http server action\n", prog);
     break;
       
   }
diff -ruN monit-4.5/log.c monit-4.5.mine/log.c
--- monit-4.5/log.c     2005-01-06 21:51:49.000000000 +0100
+++ monit-4.5.mine/log.c        2006-02-15 15:19:30.973995584 +0100
@@ -131,7 +131,7 @@
  * Log a message to monits logfile or syslog. 
  * @param s A formated (printf-style) string to log
  */
-void log_log(const char *s, ...) {
+void log_log(int prio, const char *s, ...) {
   
   long len;
   va_list ap;
@@ -147,7 +147,7 @@
 
   if(Run.use_syslog) {
     LOCK(log_mutex)
-      syslog(LOG_ERR, "%s", msg);
+      syslog(prio, "%s", msg);
     END_LOCK;
     
   } else if(LOG) {
@@ -178,7 +178,7 @@
   }
   
   if(LOG  && (0 != fclose(LOG))) {
-    log("%s: Error closing the log file -- %s\n",
+    log(LOG_ERR, "%s: Error closing the log file -- %s\n",
        prog, STRERROR);
   }
   pthread_mutex_destroy(&log_mutex);
@@ -200,7 +200,7 @@
   } else {
     umask(LOGMASK);
     if((LOG= fopen(Run.logfile,"a+")) == (FILE *)NULL) {
-      log("%s: Error opening the log file '%s' for writing -- %s\n",
+      log(LOG_ERR, "%s: Error opening the log file '%s' for writing -- %s\n",
          prog, Run.logfile, STRERROR);
       return(FALSE);
     }
diff -ruN monit-4.5/monitor.c monit-4.5.mine/monitor.c
--- monit-4.5/monitor.c 2005-02-24 21:43:59.000000000 +0100
+++ monit-4.5.mine/monitor.c    2006-02-15 15:19:30.974995432 +0100
@@ -134,7 +134,7 @@
   if((pid= exist_daemon()) > 0) {
     
     kill(pid, SIGUSR1);
-    log("%s daemon at %d awakened\n", prog, pid);
+    log(LOG_INFO, "%s daemon at %d awakened\n", prog, pid);
     
     return TRUE;
     
@@ -198,7 +198,7 @@
    */
   status= pthread_mutex_init(&Run.mutex, NULL);
   if(status != 0) {
-    log("%s: Cannot initialize mutex -- %s\n", prog, strerror(status));
+    log(LOG_ERR, "%s: Cannot initialize mutex -- %s\n", prog, 
strerror(status));
     exit(1);
   }
 
@@ -234,7 +234,7 @@
    */
   if(Run.testing) {
 
-    log("Control file syntax OK\n");
+    log(LOG_DEBUG, "Control file syntax OK\n");
     exit(0);
 
   }
@@ -253,7 +253,7 @@
    */
   if(! servicelist) {
     
-    log("%s: No services has been specified\n", prog);
+    log(LOG_DEBUG, "%s: No services has been specified\n", prog);
     exit(0);
     
   }
@@ -284,8 +284,8 @@
 
   Run.doreload= FALSE;
   
-  log("Awakened by the SIGHUP signal\n");
-  log("Reinitializing %s - Control file '%s'\n", prog, Run.controlfile);
+  log(LOG_INFO, "Awakened by the SIGHUP signal\n");
+  log(LOG_INFO, "Reinitializing %s - Control file '%s'\n", prog, 
Run.controlfile);
   
   /* Stop http interface */
   if(Run.dohttpd)
@@ -299,7 +299,7 @@
   gc();
 
   if(! parse(Run.controlfile)) {
-    log("%s daemon died\n", prog);
+    log(LOG_ERR, "%s daemon died\n", prog);
     exit(1);
   }
 
@@ -312,7 +312,7 @@
 
   /* Did we find any services ?  */
   if(! servicelist) {
-    log("%s: No services has been specified\n", prog);
+    log(LOG_INFO, "%s: No services has been specified\n", prog);
     exit(0);
   }
   
@@ -320,7 +320,7 @@
   File_init();
 
   if(! File_createPidFile(Run.pidfile)) {
-    log("%s daemon died\n", prog);
+    log(LOG_ERR, "%s daemon died\n", prog);
     exit(1);
   }
 
@@ -377,7 +377,7 @@
       goto error;
     }
   } else if(IS(action, "reload")) {
-    log("Reinitializing monit daemon\n", prog);
+    log(LOG_INFO, "Reinitializing monit daemon\n", prog);
     kill_daemon(SIGHUP);
   } else if(IS(action, "status")) {
     status();
@@ -387,7 +387,7 @@
     validate();
   } else {
   error:
-    log("%s: invalid argument -- %s  (-h will show valid arguments)\n",
+    log(LOG_ERR, "%s: invalid argument -- %s  (-h will show valid 
arguments)\n",
         prog, action);
     exit(1);
   }
@@ -411,7 +411,7 @@
     if(Run.dohttpd)
       monit_http(STOP_HTTP);
 
-    log("%s daemon with pid [%d] killed\n", prog, (int)getpid());
+    log(LOG_INFO, "%s daemon with pid [%d] killed\n", prog, (int)getpid());
 
   }
 
@@ -441,16 +441,16 @@
     Run.once= FALSE;
 
     if(can_http())
-      log("Starting %s daemon with http interface at [%s:%d]\n",
+      log(LOG_INFO, "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);
+      log(LOG_INFO, "Starting %s daemon\n", prog);
     
     if(Run.init != TRUE)
       daemonize(); 
     
     if(! File_createPidFile(Run.pidfile)) {
-      log("%s daemon died\n", prog);
+      log(LOG_ERR, "%s daemon died\n", prog);
       exit(1);
     }
 
@@ -507,7 +507,7 @@
        Run.isdaemon= TRUE;
        sscanf(optarg, "%d", &Run.polltime);
        if(Run.polltime<1) {
-         log("%s: option -%c requires a natural number\n", prog, opt);
+         log(LOG_ERR, "%s: option -%c requires a natural number\n", prog, opt);
          exit(1);
        }
        break;
@@ -532,7 +532,7 @@
         break;
 
     case 'i':
-       log("%s: option -i is obsolete\n", prog);
+       log(LOG_DEBUG, "%s: option -i is obsolete\n", prog);
        break;
       
     case 'I':
@@ -576,10 +576,10 @@
        case 'l':
        case 'p':
        case 's':
-           log("%s: option -- %c requires an argument\n", prog, optopt);
+           log(LOG_ERR, "%s: option -- %c requires an argument\n", prog, 
optopt);
            break;
        default:
-           log("%s: invalid option -- %c  (-h will show valid options)\n",
+           log(LOG_ERR, "%s: invalid option -- %c  (-h will show valid 
options)\n",
                  prog, optopt);
            
        }
@@ -670,6 +670,6 @@
  */
 static RETSIGTYPE do_wakeup(int sig) {
 
-  log("Awakened by User defined signal 1\n");
+  log(LOG_INFO, "Awakened by User defined signal 1\n");
 
 }
diff -ruN monit-4.5/monitor.h monit-4.5.mine/monitor.h
--- monit-4.5/monitor.h 2005-02-24 21:44:00.000000000 +0100
+++ monit-4.5.mine/monitor.h    2006-02-15 15:19:30.974995432 +0100
@@ -59,6 +59,10 @@
 #include <errno.h>
 #endif
 
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
 #include "ssl.h"
 #include "socket.h"
 
@@ -199,7 +203,7 @@
 /** ------------------------------------------ Simple Assert Exception macro */
 
 
-#define ASSERT(e) if(!(e)) { log("AssertException: at %s:%d\naborting..\n", \
+#define ASSERT(e) if(!(e)) { log(LOG_ERR, "AssertException: at 
%s:%d\naborting..\n", \
     __FILE__, __LINE__); abort(); }
 
 
@@ -728,7 +732,7 @@
 void  spawn(Service_T, Command_T, const char *);
 void  status();
 int   log_init() ;
-void  log_log(const char *, ...) ;
+void  log_log(int prio, const char *, ...) ;
 void  log_close();
 void  validate() ;
 void  daemonize() ;
diff -ruN monit-4.5/net.c monit-4.5.mine/net.c
--- monit-4.5/net.c     2005-02-24 21:44:01.000000000 +0100
+++ monit-4.5.mine/net.c        2006-02-15 15:19:30.975995280 +0100
@@ -750,7 +750,7 @@
   }
 
   if(FD_ISSET(s, &rset) || FD_ISSET(s, &wset)) {
-    int len= sizeof(error);
+    socklen_t len= sizeof(error);
     if(getsockopt(s, SOL_SOCKET, SO_ERROR, &error, &len) < 0)
       return -1;
   } else
diff -ruN monit-4.5/p.y monit-4.5.mine/p.y
--- monit-4.5/p.y       2005-03-28 20:55:40.000000000 +0200
+++ monit-4.5.mine/p.y  2006-02-15 15:19:30.976995128 +0100
@@ -1313,7 +1313,7 @@
   msg= Util_formatString(s, ap, &len);
   va_end(ap);
   
-  log("%s:%i: Error: %s '%s'\n", currentfile, lineno, msg, yytext);
+  log(LOG_ERR, "%s:%i: Error: %s '%s'\n", currentfile, lineno, msg, yytext);
   cfg_errflag++;
  
   FREE(msg);
@@ -1335,7 +1335,7 @@
   msg= Util_formatString(s, ap, &len);
   va_end(ap);
   
-  log("%s:%i: Warning: %s '%s'\n", currentfile, lineno, msg, yytext);
+  log(LOG_ERR, "%s:%i: Warning: %s '%s'\n", currentfile, lineno, msg, yytext);
  
   FREE(msg);
   
@@ -1356,7 +1356,7 @@
   msg= Util_formatString(s, ap, &len);
   va_end(ap);
   
-  log("%s:%i: Error: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
+  log(LOG_ERR, "%s:%i: Error: %s '%s'\n", argcurrentfile, arglineno, msg, 
argyytext);
   cfg_errflag++;
  
   FREE(msg);
@@ -1378,7 +1378,7 @@
   msg= Util_formatString(s, ap, &len);
   va_end(ap);
   
-  log("%s:%i: Warning: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
+  log(LOG_WARNING, "%s:%i: Warning: %s '%s'\n", argcurrentfile, arglineno, 
msg, argyytext);
  
   FREE(msg);
   
@@ -1404,7 +1404,7 @@
   }
 
   if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) {
-    log("%s: Error: cannot open the control file '%s' -- %s\n",
+    log(LOG_ERR, "%s: Error: cannot open the control file '%s' -- %s\n",
        prog, controlfile, STRERROR);
     return FALSE;
   }
@@ -1499,7 +1499,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"
+    log(LOG_ERR, "%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++;
@@ -1510,7 +1510,7 @@
     if(s->type != TYPE_HOST)
        continue;
     if(!s->portlist && !s->icmplist) {
-      log("%s: Error: 'check host' statement is incomplete; Please specify a"
+      log(LOG_ERR, "%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++;
@@ -2596,7 +2596,7 @@
   c->digesttype=dtype;
   c->is_readonly= readonly;
   
-  DEBUG("%s: Debug: Adding credentials for user '%s'.\n", prog, uname); 
+  DEBUG(LOG_DEBUG, "%s: Debug: Adding credentials for user '%s'.\n", prog, 
uname); 
   
   return TRUE;
   
@@ -2960,13 +2960,13 @@
       Service_T dp= Util_getService(d->dependant);
       
       if(!dp) {
-       log("%s: Error: Depend service '%s' is not defined in the "
+       log(LOG_ERR, "%s: Error: Depend service '%s' is not defined in the "
            "control file\n", prog, d->dependant);
        exit(1);
       }
       
       if(dp->depend_visited) {
-       log("%s: Error: Found a depend loop in the control file "
+       log(LOG_ERR, "%s: Error: Found a depend loop in the control file "
            "involving the service '%s'\n", prog, s->name);
        exit(1);
       }
diff -ruN monit-4.5/process/process_common.c 
monit-4.5.mine/process/process_common.c
--- monit-4.5/process/process_common.c  2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/process/process_common.c     2006-02-15 15:19:30.982994216 
+0100
@@ -100,7 +100,7 @@
     
   if ( (fd = open(filename, O_RDONLY)) < 0 ) {
 
-    DEBUG("cannot open file %s -- %s\n", filename, STRERROR);
+    DEBUG(LOG_DEBUG, "cannot open file %s -- %s\n", filename, STRERROR);
 
     return FALSE;
 
@@ -110,7 +110,7 @@
 
     close(fd);
 
-    DEBUG("cannot read file %s -- %s\n", filename, STRERROR);
+    DEBUG(LOG_DEBUG, "cannot read file %s -- %s\n", filename, STRERROR);
 
     return FALSE;
 
diff -ruN monit-4.5/process/sysdep_LINUX.c monit-4.5.mine/process/sysdep_LINUX.c
--- monit-4.5/process/sysdep_LINUX.c    2005-02-20 10:23:50.000000000 +0100
+++ monit-4.5.mine/process/sysdep_LINUX.c       2006-02-15 15:19:30.982994216 
+0100
@@ -121,18 +121,18 @@
   }
   if(!(ptr= strstr(buf, MEMTOTAL)))
   {
-    DEBUG("system statistic error -- cannot get real memory amount\n");
+    DEBUG(LOG_DEBUG,"system statistic error -- cannot get real memory 
amount\n");
     return FALSE;
   }
   if(sscanf(ptr+strlen(MEMTOTAL), "%ld", &systeminfo.mem_kbyte_max) != 1)
   {
-    DEBUG("system statistic error -- cannot get real memory amount\n");
+    DEBUG(LOG_DEBUG,"system statistic error -- cannot get real memory 
amount\n");
     return FALSE;
   }
 
   if((num_cpus = sysconf(_SC_NPROCESSORS_CONF)) == -1)
   {
-    DEBUG("system statistic error -- cannot get cpu count: %s\n", STRERROR);
+    DEBUG(LOG_DEBUG,"system statistic error -- cannot get cpu count: %s\n", 
STRERROR);
     return FALSE;
   }
 
@@ -167,7 +167,7 @@
   /* Find all processes in the /proc directory */
   if(glob("/proc/[0-9]*", GLOB_ONLYDIR, NULL, &globbuf))
   {
-    log("system statistic error -- glob failed\n");
+    log(LOG_ERR, "system statistic error -- glob failed\n");
     return FALSE;
   } 
 
@@ -182,7 +182,7 @@
     
     if(!read_proc_file(buf, 4096, "stat", pt[i].pid))
     {
-      DEBUG(
+      DEBUG(LOG_DEBUG,
         "system statistic error -- cannot read /proc/%d/stat\n",
         pt[i].pid);
       continue;
@@ -193,7 +193,7 @@
     /* Move along the buffer to get past the process name */
     if(!(tmp = strrchr(buf, ')')))
     {
-      DEBUG(
+      DEBUG(LOG_DEBUG,
         "system statistic error -- file /proc/%d/stat parse error\n",
         pt[i].pid);
       continue;
@@ -216,7 +216,7 @@
          &stat_item_cstime,
          &stat_item_rss) != 7)
     {
-      DEBUG(
+      DEBUG(LOG_DEBUG,
         "system statistic error -- file /proc/%d/stat parse error\n",
         pt[i].pid);
       continue;
@@ -280,40 +280,40 @@
   
   if(!read_proc_file(buf, 1024, "meminfo", -1))
   {
-    log("system statistic error -- cannot get real memory free amount\n");
+    log(LOG_ERR, "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");
+    log(LOG_ERR, "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");
+    log(LOG_ERR, "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");
+    log(LOG_ERR, "system statistic error -- cannot get real memory beffers 
amount\n");
     goto error;
   }
   if(sscanf(ptr + strlen(MEMBUF), "%ld", &buffers) != 1)
   {
-    log("system statistic error -- cannot get real memory buffers amount\n");
+    log(LOG_ERR, "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");
+    log(LOG_ERR, "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");
+    log(LOG_ERR, "system statistic error -- cannot get real memory cache free 
amount\n");
     goto error;
   }
 
@@ -321,14 +321,14 @@
 
   if(si->total_mem_kbyte < 0)
   {
-    log("system statistic error -- memory usage statistic error\n");
+    log(LOG_ERR, "system statistic error -- memory usage statistic error\n");
     goto error;
   }
 
   return TRUE;
 
   error:
-  log("system statistic error -- memory usage gathering failed\n");
+  log(LOG_ERR, "system statistic error -- memory usage gathering failed\n");
   si->total_mem_kbyte = 0;
   return FALSE;
 }
@@ -348,14 +348,14 @@
 
   if(!read_proc_file(buf, 1024, "stat", -1))
   {
-    log("system statistic error -- cannot read /proc/stat\n");
+    log(LOG_ERR, "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");
+    log(LOG_ERR, "system statistic error -- cannot read cpu usage\n");
     goto error;
   }
   else
diff -ruN monit-4.5/process.c monit-4.5.mine/process.c
--- monit-4.5/process.c 2005-02-15 20:42:00.000000000 +0100
+++ monit-4.5.mine/process.c    2006-02-15 15:19:30.976995128 +0100
@@ -197,10 +197,10 @@
     /** Get load average triplet */
     if(-1 == getloadavg_sysdep(systeminfo.loadavg, 3))
     {
-      log("'system' statistic error -- load average gathering failed\n");
+      log(LOG_ERR, "'system' statistic error -- load average gathering 
failed\n");
       goto error1;
     }
-    DEBUG("'system' load average [%.2f][%.2f][%.2f]\n",
+    DEBUG(LOG_DEBUG, "'system' load average [%.2f][%.2f][%.2f]\n",
       systeminfo.loadavg[0],
       systeminfo.loadavg[1],
       systeminfo.loadavg[2]);
@@ -208,7 +208,7 @@
     /** Get real memory usage statistic */
     if(!used_system_memory_sysdep(&systeminfo))
     {
-      DEBUG("'system' statistic -- memory usage gathering method fallback\n");
+      DEBUG(LOG_DEBUG, "'system' statistic -- memory usage gathering method 
fallback\n");
       /* Update the total real memory usage by monitoring process with PID 1 */
       if((leaf = findprocess(1, pt, treesize)) && leaf->mem_kbyte_sum > 0)
       {
@@ -216,20 +216,20 @@
       }
       else
       {
-        log("'system' statistic error -- memory usage gathering failed\n");
+        log(LOG_ERR, "'system' statistic error -- memory usage gathering 
failed\n");
         goto error2;
       }
     }
     systeminfo.total_mem_percent = (int)(1000 *
       (double)systeminfo.total_mem_kbyte / (double)systeminfo.mem_kbyte_max);
-    DEBUG("'system' memory usage %.1f%% [%ld kB]\n",
+    DEBUG(LOG_DEBUG, "'system' memory usage %.1f%% [%ld kB]\n",
       systeminfo.total_mem_percent / 10.,
       systeminfo.total_mem_kbyte);
 
     /** Get CPU usage statistic */
     if(!used_system_cpu_sysdep(&systeminfo))
     {
-      DEBUG("'system' statistic -- cpu usage gathering method fallback\n");
+      DEBUG(LOG_DEBUG, "'system' statistic -- cpu usage gathering method 
fallback\n");
       /* Update the total CPU load by monitoring process with PID 1 */
       if((leaf = findprocess(1, pt, treesize)))
       {
@@ -239,11 +239,11 @@
       }
       else
       {
-        log("'system' statistic error -- cpu usage gathering failed\n");
+        log(LOG_ERR, "'system' statistic error -- cpu usage gathering 
failed\n");
         goto error3;
       }
     }
-    DEBUG("'system' cpu usage %.1f%%us %.1f%%sy %.1f%%wa\n",
+    DEBUG(LOG_DEBUG, "'system' cpu usage %.1f%%us %.1f%%sy %.1f%%wa\n",
       systeminfo.total_cpu_user_percent / 10.,
       systeminfo.total_cpu_syst_percent / 10.,
       systeminfo.total_cpu_wait_percent / 10.);
@@ -287,7 +287,7 @@
   
   if((*size_r = initprocesstree_sysdep(pt_r)) <= 0)
   {
-    DEBUG("system statistic error -- cannot initialize the process tree\n");
+    DEBUG(LOG_DEBUG, "system statistic error -- cannot initialize the process 
tree\n");
     return -1;
   }
 
@@ -344,7 +344,7 @@
     {
       /* Inconsitency found, process orphaned most probably by a race
          condition. we might lack accuracy but we remain stable! */
-      DEBUG("system statistic error -- orphaned process id %d\n", pt[i].pid);
+      DEBUG(LOG_DEBUG, "system statistic error -- orphaned process id %d\n", 
pt[i].pid);
       pt[i].pid = 0;
       continue;
     }
@@ -353,7 +353,7 @@
     {
       /* connection to parent process has failed, this is
         usually caused in the part above */
-      DEBUG(
+      DEBUG(LOG_DEBUG,
         "system statistic error -- "
         "cannot connect process id %d to its parent %d\n",
         pt[i].pid, pt[i].ppid);
@@ -365,7 +365,7 @@
 
   if(! (root = findprocess(1, pt, *size_r)))
   {
-    DEBUG("system statistic error -- cannot find process id 1\n",
+    DEBUG(LOG_DEBUG,"system statistic error -- cannot find process id 1\n",
       pt[i].pid, pt[i].ppid);
     return -1;
   }
diff -ruN monit-4.5/protocols/apache_status.c 
monit-4.5.mine/protocols/apache_status.c
--- monit-4.5/protocols/apache_status.c 2005-01-09 19:50:33.000000000 +0100
+++ monit-4.5.mine/protocols/apache_status.c    2006-02-15 15:19:30.986993608 
+0100
@@ -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);
+    log(LOG_ERR, "HTTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
   
@@ -149,7 +149,7 @@
     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);
+       log(LOG_ERR, "APACHE-STATUS error: parsing Apache status response 
'%s'\n", line);
        return FALSE;
       }else{
         scored = 1;
@@ -157,11 +157,11 @@
     }
   }
   
-  DEBUG("Scoreboard: %s\n", search_string);
+  DEBUG(LOG_DEBUG, "Scoreboard: %s\n", search_string);
   
   /* 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");
+    log(LOG_ERR, "APACHE-STATUS error: no scoreboard line returned by 
Apache\n");
     return FALSE;
   }
   
@@ -206,7 +206,7 @@
   }
 
   if(active_servers <= 0){
-    log("APACHE-STATUS warning: No idle server or threads found\n");
+    log(LOG_ERR, "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 +218,7 @@
   if(loglimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.loglimitOP, 
                            (100 * no_logging / active_servers), loglimit)) {
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
           " %i percent of Apache processes are logging\n", loglimit);
       errors++;
     }
@@ -227,7 +227,7 @@
   if(startlimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.startlimitOP, 
                            (100 * no_start / active_servers), startlimit)) {
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
           " %i percent of Apache processes are starting\n", startlimit);
       errors++;
     }
@@ -236,7 +236,7 @@
   if(requestlimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.requestlimitOP, 
                    (100 * no_request / active_servers), requestlimit)) {
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
           " %i percent of Apache processes are reading requests\n", 
          requestlimit);
       errors++;
@@ -246,7 +246,7 @@
   if(replylimit > 0 ){
     if(Util_evalQExpression(myPort->ApacheStatus.replylimitOP, 
                            (100 * no_reply / active_servers), replylimit)) {
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
           " %i percent of Apache processes are sending a reply\n", replylimit);
       errors++;
     }
@@ -255,7 +255,7 @@
   if(keepalivelimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.keepalivelimitOP, 
                    (100 * no_keepalive / active_servers), keepalivelimit)) {
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
          " %i percent of Apache processes are in keepalive\n", keepalivelimit);
       errors++;
     }
@@ -264,7 +264,7 @@
   if(dnslimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.dnslimitOP, 
                            (100 * no_dns / active_servers), dnslimit)) {
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
          " %i percent of Apache processes are waiting for DNS\n", dnslimit);
       errors++;
     }
@@ -273,7 +273,7 @@
   if(closelimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.closelimitOP, 
                            (100 * no_close / active_servers), closelimit)){
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
          " %i percent of Apache processes are closing connections\n", 
          closelimit);
       errors++;
@@ -283,7 +283,7 @@
   if(gracefullimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.gracefullimitOP, 
                     (100 * no_graceful / active_servers), gracefullimit)) {
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
          " %i percent of Apache processes are finishing gracefully\n", 
          gracefullimit);
       errors++;
@@ -293,7 +293,7 @@
   if(cleanuplimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.cleanuplimitOP, 
                    (100 * no_cleanup / active_servers), cleanuplimit)) {
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
          " %i percent of Apache processes are in idle cleanup\n", 
          cleanuplimit);
       errors++;
@@ -303,7 +303,7 @@
   if(waitlimit > 0){
     if(Util_evalQExpression(myPort->ApacheStatus.waitlimitOP, 
                            (100 * no_wait / active_servers), waitlimit)) {
-      log("APACHE-STATUS error:"
+      log(LOG_ERR, "APACHE-STATUS error:"
          " %i percent of Apache processes are waiting for a connection\n", 
          waitlimit);
       errors++;
diff -ruN monit-4.5/protocols/dwp.c monit-4.5.mine/protocols/dwp.c
--- monit-4.5/protocols/dwp.c   2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/dwp.c      2006-02-15 15:19:30.983994064 +0100
@@ -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);
+    log(LOG_ERR, "DWP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
   
   if(! socket_readln(s, buf, sizeof(buf))) {
-    log("DWP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "DWP error: %s\n", buf);
     return FALSE;
   }
   
diff -ruN monit-4.5/protocols/ftp.c monit-4.5.mine/protocols/ftp.c
--- monit-4.5/protocols/ftp.c   2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/ftp.c      2006-02-15 15:19:30.983994064 +0100
@@ -53,7 +53,7 @@
   ASSERT(s);
 
   if(! socket_readln(s, buf, STRLEN)) {
-    log("FTP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "FTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -61,7 +61,7 @@
   
   sscanf(buf, "%d %s", &status, msg);
   if(status != 220) {
-    log("FTP error: %s\n", buf);
+    log(LOG_ERR, "FTP error: %s\n", buf);
     return FALSE;
   }
 
@@ -71,12 +71,12 @@
   }
   
   if(socket_print(s, "QUIT\r\n") < 0) {
-    log("FTP: error sending data -- %s\n", STRERROR);
+    log(LOG_ERR, "FTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, buf, STRLEN) <= 0) {
-    log("FTP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "FTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -84,7 +84,7 @@
 
   sscanf(buf, "%d %s", &status, msg);
   if(status != 221) {
-    log("FTP error: %s\n", buf);
+    log(LOG_ERR, "FTP error: %s\n", buf);
     return FALSE;
   }
 
diff -ruN monit-4.5/protocols/generic.c monit-4.5.mine/protocols/generic.c
--- monit-4.5/protocols/generic.c       2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/generic.c  2006-02-15 15:19:30.983994064 +0100
@@ -70,12 +70,12 @@
 
       if(socket_print(s, "%s", g->send) < 0) {
 
-        log("GENERIC: error sending data -- %s\n", STRERROR);
+        log(LOG_ERR, "GENERIC: error sending data -- %s\n", STRERROR);
         return FALSE;
 
       } else {
 
-        DEBUG("GENERIC: successfully sent: '%s'\n", g->send); 
+        DEBUG(LOG_DEBUG,"GENERIC: successfully sent: '%s'\n", g->send); 
         
       }
                 
@@ -83,7 +83,7 @@
 
       if(socket_readln(s, buf, STRLEN) == NULL) {
         
-        log("GENERIC: error receiving data -- %s\n", STRERROR);
+        log(LOG_ERR, "GENERIC: error receiving data -- %s\n", STRERROR);
         return FALSE;
         
       }
@@ -96,12 +96,12 @@
                             0);
       if (regex_return != 0) {
 
-        log("GENERIC: receiving unexpected data [%s]\n", buf);
+        log(LOG_ERR, "GENERIC: receiving unexpected data [%s]\n", buf);
         return FALSE;
 
       } else {
 
-        DEBUG("GENERIC: successfully received: '%s'\n", buf); 
+        DEBUG(LOG_DEBUG,"GENERIC: successfully received: '%s'\n", buf); 
         
       }
       
@@ -110,12 +110,12 @@
 
       if ( strncmp(buf, g->expect, strlen(g->expect)) != 0 ) {
 
-        log("GENERIC: receiving unexpected data\n");
+        log(LOG_ERR, "GENERIC: receiving unexpected data\n");
         return FALSE;
 
       } else {
 
-        DEBUG("GENERIC: successfully received: '%s'\n", buf); 
+        DEBUG(LOG_DEBUG,"GENERIC: successfully received: '%s'\n", buf); 
         
       } 
       
@@ -124,7 +124,7 @@
     } else {
 
       /* This should not happen */
-      log("GENERIC: unexpected strageness\n");
+      log(LOG_ERR, "GENERIC: unexpected strageness\n");
       return FALSE;
       
     }
diff -ruN monit-4.5/protocols/http.c monit-4.5.mine/protocols/http.c
--- monit-4.5/protocols/http.c  2005-03-26 08:38:20.000000000 +0100
+++ monit-4.5.mine/protocols/http.c     2006-02-15 15:19:30.984993912 +0100
@@ -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);
+    log(LOG_ERR, "HTTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -170,7 +170,7 @@
          
   case SC_MOVED_TEMPORARILY:
     if(!do_redirect(&H)) {
-      DEBUG("HTTP warning: cannot follow redirect\n");
+      DEBUG(LOG_DEBUG,"HTTP warning: cannot follow redirect\n");
       /* The server did respond so this is not strictly an error, but
         it's probably an error to continue from here */
       return TRUE;
@@ -179,7 +179,7 @@
          
   default:
     if(H.status>=400) {
-      log("HTTP error: Server returned status %d\n", H.status);
+      log(LOG_ALERT, "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"
+      log(LOG_ALERT, "HTTP error: Failed regular expression test on content"
          " returned from server\n");
       return FALSE;
     }
@@ -208,7 +208,7 @@
   long content_length= H->content_length;
 
   if(! content_length) {
-    DEBUG("HTTP warning: Response does not contain Content-Length\n");
+    DEBUG(LOG_DEBUG,"HTTP warning: Response does not contain 
Content-Length\n");
   } else {
     
     char *r;
@@ -251,7 +251,7 @@
        break;
       }
     default:
-      DEBUG("HTTP warning: Unknown hash type\n");
+      DEBUG(LOG_DEBUG,"HTTP warning: Unknown hash type\n");
       return FALSE;
     }
     r= result;
@@ -259,10 +259,10 @@
       r+= snprintf(r, STRLEN-(r-result) ,"%02x", hash[i]);
     }
     if(strncasecmp(result, checksum, keylength*2) != 0) {
-      DEBUG("HTTP warning: Document checksum mismatch\n");
+      DEBUG(LOG_DEBUG,"HTTP warning: Document checksum mismatch\n");
       return FALSE;
     } else {
-      DEBUG("HTTP: Succeeded testing document checksum\n");
+      DEBUG(LOG_DEBUG,"HTTP: Succeeded testing document checksum\n");
     }
   }
   
@@ -287,7 +287,7 @@
   }
 
   if(H->content_length == 0) {
-    log("HTTP error: Cannot test regex -- No content returned from server\n");
+    log(LOG_ERR, "HTTP error: Cannot test regex -- No content returned from 
server\n");
     return FALSE;
   }
  
@@ -301,7 +301,7 @@
   n= socket_read(H->s, buf, H->content_length);
   if(n<=0) {
     rv= FALSE;
-    log("HTTP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "HTTP: error receiving data -- %s\n", STRERROR);
     goto error;
   }
   buf[n]= 0;
@@ -319,7 +319,7 @@
        if(regex_return!=0) {
          rv= FALSE;
        } else {
-         DEBUG("HTTP: Regular expression test succeeded\n");
+         DEBUG(LOG_DEBUG,"HTTP: Regular expression test succeeded\n");
          
        }
        break;
@@ -328,13 +328,13 @@
        if(regex_return == 0) {
          rv= FALSE;
        } else {
-         DEBUG("HTTP: Regular expression test succeeded\n");
+         DEBUG(LOG_DEBUG,"HTTP: Regular expression test succeeded\n");
          
        }
        break;
 
       default:
-       log("HTTP error: Invalid content operator\n");
+       log(LOG_ERR, "HTTP error: Invalid content operator\n");
       }
        
 #else
@@ -346,19 +346,19 @@
       case OPERATOR_EQUAL:
        if(!regex_return) {
          rv= FALSE;
-         DEBUG("HTTP: Regular expression does not match\n");
+         DEBUG(LOG_DEBUG,"HTTP: Regular expression does not match\n");
        }
        break;
 
       case OPERATOR_NOTEQUAL:
        if(regex_return) {
          rv= FALSE;
-         DEBUG("HTTP: Regular expression match\n");
+         DEBUG(LOG_DEBUG,"HTTP: Regular expression match\n");
        }
        break;
 
       default:
-       log("HTTP error: Invalid content operator\n");
+       log(LOG_ERR, "HTTP error: Invalid content operator\n");
       }
       
 #endif
@@ -380,12 +380,12 @@
   Port_T P= socket_get_Port(H->s);
 
   if(!*H->location) {
-    DEBUG("HTTP error: Missing Location header in response\n");
+    DEBUG(LOG_DEBUG,"HTTP error: Missing Location header in response\n");
     return FALSE;
   }
 
   if(H->closed) {
-    DEBUG("HTTP warning: Aborting test, connection was closed\n");
+    DEBUG(LOG_DEBUG,"HTTP warning: Aborting test, connection was closed\n");
     return FALSE;
   }
 
@@ -399,7 +399,7 @@
                  H->location, Util_getHTTPHostHeader(H->s, host,STRLEN), 
                  prog, VERSION, H->cookie, get_auth_header(P, auth, STRLEN))
      < 0) {
-    DEBUG("HTTP error: Failed sending data -- %s\n", STRERROR);
+    DEBUG(LOG_DEBUG,"HTTP error: Failed sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -439,14 +439,14 @@
   H->content_length= -1;
 
   if(! socket_readln(H->s, buf, LINE_SIZE)) {
-    log("HTTP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "HTTP error: cannot parse HTTP status in response: %s\n", 
buf);
     return FALSE;
   }
 
@@ -459,18 +459,18 @@
    
     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);
+       log(LOG_ERR, "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);
+       log(LOG_ERR, "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);
+       log(LOG_ERR, "HTTP error: parsing Location response header '%s'\n", 
buf);
        return FALSE;
       }
     }
@@ -478,7 +478,7 @@
     if(Util_startsWith(buf, "Connection")) {
       char *p= strchr(buf, ':');
       if(!p) {
-       log("HTTP error: parsing Connection response header '%s'\n", buf);
+       log(LOG_ERR, "HTTP error: parsing Connection response header '%s'\n", 
buf);
        return FALSE;
       }
       Util_trim(++p);
@@ -489,7 +489,7 @@
       char *s;
       char *p= strchr(buf, ':');
       if(!p) {
-       log("HTTP error: parsing Cookie response header '%s'\n", buf);
+       log(LOG_ERR, "HTTP error: parsing Cookie response header '%s'\n", buf);
        return FALSE;
       }
       Util_trim(++p);
diff -ruN monit-4.5/protocols/imap.c monit-4.5.mine/protocols/imap.c
--- monit-4.5/protocols/imap.c  2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/imap.c     2006-02-15 15:19:30.984993912 +0100
@@ -57,31 +57,31 @@
   ASSERT(s);
   
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("IMAP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "IMAP error: %s\n", buf);
     return FALSE;
   }
   
   if(socket_print(s, "001 LOGOUT\r\n") < 0) {
-    log("IMAP: error sending data -- %s\n", STRERROR);
+    log(LOG_ERR, "IMAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("IMAP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "IMAP error: %s\n", buf);
     return FALSE;
   }
 
diff -ruN monit-4.5/protocols/ldap2.c monit-4.5.mine/protocols/ldap2.c
--- monit-4.5/protocols/ldap2.c 2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/ldap2.c    2006-02-15 15:19:30.984993912 +0100
@@ -123,24 +123,24 @@
 
 
   if(socket_write(s, (unsigned char *)request, sizeof(request)) < 0) {
-    log("LDAP: error sending data -- %s\n", STRERROR);
+    log(LOG_ERR, "LDAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, (unsigned char *)buf, sizeof(buf)) <= 0) {
-    log("LDAP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "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");
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "LDAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
diff -ruN monit-4.5/protocols/ldap3.c monit-4.5.mine/protocols/ldap3.c
--- monit-4.5/protocols/ldap3.c 2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/ldap3.c    2006-02-15 15:19:30.984993912 +0100
@@ -123,24 +123,24 @@
 
 
   if(socket_write(s, (unsigned char *)request, sizeof(request)) < 0) {
-    log("LDAP: error sending data -- %s\n", STRERROR);
+    log(LOG_ERR, "LDAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, (unsigned char *)buf, sizeof(buf)) <= 0) {
-    log("LDAP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "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");
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "LDAP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
diff -ruN monit-4.5/protocols/nntp.c monit-4.5.mine/protocols/nntp.c
--- monit-4.5/protocols/nntp.c  2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/nntp.c     2006-02-15 15:19:30.985993760 +0100
@@ -52,7 +52,7 @@
   ASSERT(s);
 
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("NNTP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "NNTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -60,17 +60,17 @@
   
   sscanf(buf, "%d %s", &status, msg);
   if(status != 200) {
-    log("NNTP error: %s\n", buf);
+    log(LOG_ERR, "NNTP error: %s\n", buf);
     return FALSE;
   }
 
   if(socket_print(s, "QUIT\r\n") < 0) {
-    log("NNTP: error sending data -- %s\n", STRERROR);
+    log(LOG_ERR, "NNTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("NNTP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "NNTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -78,7 +78,7 @@
 
   sscanf(buf, "%d %s", &status, msg);
   if(status != 205) {
-    log("NNTP error: %s\n", buf);
+    log(LOG_ERR, "NNTP error: %s\n", buf);
     return FALSE;
   }
 
diff -ruN monit-4.5/protocols/ntp3.c monit-4.5.mine/protocols/ntp3.c
--- monit-4.5/protocols/ntp3.c  2005-02-03 22:13:35.000000000 +0100
+++ monit-4.5.mine/protocols/ntp3.c     2006-02-15 15:19:30.987993456 +0100
@@ -82,18 +82,18 @@
 
   /* Send request to NTP server */
   if( (br= socket_write(s, ntpRequest, NTPLEN)) <= 0 ) {
-    log("NTP: error sending NTP request -- %s\n", STRERROR);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "NTP: Received %d bytes from server, expected %d bytes\n", 
br, NTPLEN);
     return FALSE;
   }
 
@@ -113,7 +113,7 @@
         )
     )
   {
-    log("NTP: Server response error\n");
+    log(LOG_ERR, "NTP: Server response error\n");
     return FALSE;
   }
 
diff -ruN monit-4.5/protocols/pop.c monit-4.5.mine/protocols/pop.c
--- monit-4.5/protocols/pop.c   2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/pop.c      2006-02-15 15:19:30.985993760 +0100
@@ -55,31 +55,31 @@
   ASSERT(s);
   
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("POP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "POP error: %s\n", buf);
     return FALSE;
   }
   
   if(socket_print(s, "QUIT\r\n") < 0) {
-    log("POP: error sending data -- %s\n", STRERROR);
+    log(LOG_ERR, "POP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("POP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "POP error: %s\n", buf);
     return FALSE;
   }
 
diff -ruN monit-4.5/protocols/rdate.c monit-4.5.mine/protocols/rdate.c
--- monit-4.5/protocols/rdate.c 2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/rdate.c    2006-02-15 15:19:30.985993760 +0100
@@ -66,7 +66,7 @@
   ASSERT(s);
   
   if(socket_read(s,(char*) &rdatet, sizeof(time_t)) <= 0) {
-    log("RDATE: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "RDATE error: time does not match system time -- %s\n", 
STRERROR);
     return FALSE;
   }
   
diff -ruN monit-4.5/protocols/rsync.c monit-4.5.mine/protocols/rsync.c
--- monit-4.5/protocols/rsync.c 2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/rsync.c    2006-02-15 15:19:30.985993760 +0100
@@ -54,7 +54,7 @@
   ASSERT(s);
     
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("RSYNC: did not see server greeting  -- %s\n", STRERROR);
+    log(LOG_ERR, "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);
+     log(LOG_ERR, "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);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "RSYNC: error sending writing #list command  -- %s\n", 
STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("RSYNC: did not see server answer  -- %s\n", STRERROR);
+    log(LOG_ERR, "RSYNC: did not see server answer  -- %s\n", STRERROR);
     return FALSE;
   }
   
diff -ruN monit-4.5/protocols/smtp.c monit-4.5.mine/protocols/smtp.c
--- monit-4.5/protocols/smtp.c  2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/smtp.c     2006-02-15 15:19:30.986993608 +0100
@@ -53,7 +53,7 @@
   ASSERT(s);
 
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("SMTP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "SMTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -61,17 +61,17 @@
   
   sscanf(buf, "%d %s", &status, msg);
   if(status != 220) {
-    log("SMTP error: %s\n", buf);
+    log(LOG_ERR, "SMTP error: %s\n", buf);
     return FALSE;
   }
 
   if(socket_print(s, "QUIT\r\n") < 0) {
-    log("SMTP: error sending data -- %s\n", STRERROR);
+    log(LOG_ERR, "SMTP: error sending data -- %s\n", STRERROR);
     return FALSE;
   }
 
   if(socket_read(s, buf, sizeof(buf)) <= 0) {
-    log("SMTP: error receiving data -- %s\n", STRERROR);
+    log(LOG_ERR, "SMTP: error receiving data -- %s\n", STRERROR);
     return FALSE;
   }
 
@@ -79,7 +79,7 @@
   
   sscanf(buf, "%d %s", &status, msg);
   if(status != 221) {
-    log("SMTP error: %s\n", buf);
+    log(LOG_ERR, "SMTP error: %s\n", buf);
     return FALSE;
   }
 
diff -ruN monit-4.5/protocols/ssh.c monit-4.5.mine/protocols/ssh.c
--- monit-4.5/protocols/ssh.c   2005-01-06 21:51:50.000000000 +0100
+++ monit-4.5.mine/protocols/ssh.c      2006-02-15 15:19:30.986993608 +0100
@@ -49,18 +49,18 @@
   ASSERT(s);
     
   if((n= socket_read(s, buf, sizeof(buf))) <= 0) {
-    log("SSH: error receiving identification string -- %s\n", STRERROR);
+    log(LOG_ERR, "SSH: error receiving identification string -- %s\n", 
STRERROR);
     return FALSE;
   }
   
   if(! Util_startsWith(buf, "SSH-")) {
-    log("SSH: protocol error %s\n", buf);
+    log(LOG_ERR, "SSH: protocol error %s\n", buf);
     return FALSE;
   }
 
   /* send identification string back to server */
   if(socket_write(s, buf, n) <= 0) {
-    log("SSH: error sending identification string -- %s\n", STRERROR);
+    log(LOG_ERR, "SSH: error sending identification string -- %s\n", STRERROR);
     return FALSE;
   }
    
diff -ruN monit-4.5/sendmail.c monit-4.5.mine/sendmail.c
--- monit-4.5/sendmail.c        2005-02-20 00:52:19.000000000 +0100
+++ monit-4.5.mine/sendmail.c   2006-02-15 15:19:30.976995128 +0100
@@ -167,7 +167,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",
+    log(LOG_ERR, "Sendmail: error sending data to the server '%s' -- %s\n",
        S->server, STRERROR);
     siglongjmp(S->error, TRUE);
   }
@@ -181,14 +181,14 @@
   char buf[STRLEN];
   
   if (socket_read(S->socket, buf, sizeof(buf)) <= 0) {
-    log("Sendmail: error receiving data from the mailserver '%s' -- %s\n",
+    log(LOG_ERR, "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);
+    log(LOG_ERR, "Sendmail error: %s\n", buf);
     siglongjmp(S->error, TRUE);
   }
 }
@@ -205,15 +205,15 @@
                          Run.mailserver_timeout);
     if(S->socket)
       break;
-    log("Cannot open a connection to the mailserver '%s:%i' -- %s\n",
+    log(LOG_ERR, "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);
+      log(LOG_ERR, "Trying the next mail server '%s:%i'\n", S->server, 
S->port);
       continue;
     } else {
-      log("No mail servers are available, aborting alert\n");
+      log(LOG_ERR, "No mail servers are available, aborting alert\n");
       /* FIXME: Add mail to a queue for later retry */
       siglongjmp(S->error, TRUE);
     }
diff -ruN monit-4.5/spawn.c monit-4.5.mine/spawn.c
--- monit-4.5/spawn.c   2005-02-13 21:07:13.000000000 +0100
+++ monit-4.5.mine/spawn.c      2006-02-15 15:19:30.977994976 +0100
@@ -129,7 +129,7 @@
   ASSERT(C);
 
   if(access(C->arg[0], X_OK) != 0) {
-    log("Error: Could not execute %s\n", C->arg[0]);
+    log(LOG_ERR, "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");  
+    log(LOG_ERR, "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");
+      log(LOG_ERR, "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]);
+    log(LOG_ERR, "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]);
+    log(LOG_ERR, "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]);
+    log(LOG_ERR, "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]);
+    log(LOG_ERR, "Cannot redirect IO to /dev/null for '%s'\n", C->arg[0]);
 
   free_monit_environment(&environment);
   ASSERT(environment == NULL);
diff -ruN monit-4.5/ssl.c monit-4.5.mine/ssl.c
--- monit-4.5/ssl.c     2005-02-15 20:20:09.000000000 +0100
+++ monit-4.5.mine/ssl.c        2006-02-15 15:19:30.978994824 +0100
@@ -199,14 +199,14 @@
 
   } else {
 
-    log("%s: embed_ssl_socket (): Socket error!\n", prog);
+    log(LOG_ERR, "%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", 
+    log(LOG_ERR, "%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);
+    log(LOG_ERR, "%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",
+      log(LOG_ERR, "%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", 
+    log(LOG_ERR, "%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);
+    log(LOG_ERR, "%s: create_ssl_socket(): Cannot connect!\n", prog);
     goto sslerror;
 
   }
@@ -595,7 +595,7 @@
   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);
+    log(LOG_ERR, "%s: init_ssl_server (): Cannot initialize the SSL 
method!\n", prog);
     goto sslerror;
 
   }
@@ -603,7 +603,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"
+    log(LOG_ERR, "%s: init_ssl_server (): Cannot initialize SSL server"
          " certificate handler!\n"
          , prog);
     goto sslerror;
@@ -614,7 +614,7 @@
                                   SSL_FILETYPE_PEM) <= 0) {
 
     handle_ssl_error("init_ssl_server()");
-    log("%s: init_ssl_server(): Cannot initialize SSL server"
+    log(LOG_ERR, "%s: init_ssl_server(): Cannot initialize SSL server"
          " certificate!\n", prog);
     goto sslerror;
 
@@ -624,7 +624,7 @@
                                  SSL_FILETYPE_PEM) <= 0) {
 
     handle_ssl_error("init_ssl_server()");
-    log("%s: init_ssl_server(): Cannot initialize SSL server" 
+    log(LOG_ERR, "%s: init_ssl_server(): Cannot initialize SSL server" 
          " private key!\n", prog);
     goto sslerror;
 
@@ -633,7 +633,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"
+    log(LOG_ERR, "%s: init_ssl_server(): The private key does not match the"
          " certificate public key!\n", prog);
     goto sslerror;
 
@@ -645,7 +645,7 @@
   if (!verify_init(ssl_server)) {
 
     handle_ssl_error("init_ssl_server()");
-    log("%s: init_ssl_server(): Verification engine was not"
+    log(LOG_ERR, "%s: init_ssl_server(): Verification engine was not"
          " properly initialized!\n", prog);
     goto sslerror;
 
@@ -704,7 +704,7 @@
 
   if ((socket= create_server_socket(port, backlog, bindAddr)) == -1) {
 
-    log("%s: create_ssl_server_socket(): Cannot connect!\n", prog);
+    log(LOG_ERR, "%s: create_ssl_server_socket(): Cannot connect!\n", prog);
     goto sslerror;
 
   }
@@ -1039,7 +1039,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"
+    log(LOG_ERR, "%s: embed_accepted_ssl_socket(): Cannot initialize the"
          " SSL handler!\n", prog); 
     goto sslerror;
 
@@ -1047,7 +1047,7 @@
 
   if(socket < 0) {
 
-    log("Socket error!\n");
+    log(LOG_ERR, "Socket error!\n");
     goto sslerror;
 
   }
@@ -1057,7 +1057,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", 
+    log(LOG_ERR, "%s: embed_accepted_ssl_socket(): Cannot generate IO 
buffer!\n", 
          prog);
     goto sslerror;
 
@@ -1071,7 +1071,7 @@
 
     if((time(NULL)-ssl_time) > SSL_TIMEOUT) {
 
-      log("%s: embed_accepted_ssl_socket(): SSL service timeout!\n", 
+      log(LOG_ERR, "%s: embed_accepted_ssl_socket(): SSL service timeout!\n", 
            prog);
       goto sslerror;
       
@@ -1096,7 +1096,7 @@
 
   if(!update_ssl_cert_data(ssl) && (ssl->clientpemfile != NULL)) {
 
-    log("%s: The client did not supply a required client certificate!\n", 
+    log(LOG_ERR, "%s: The client did not supply a required client 
certificate!\n", 
          prog);
     goto sslerror;
 
@@ -1104,7 +1104,7 @@
 
   if (SSL_get_verify_result(ssl->handler)>0) {
 
-    log("%s: Verification of the certificate has failed!\n", 
+    log(LOG_ERR, "%s: Verification of the certificate has failed!\n", 
          prog);
     goto sslerror;
 
@@ -1384,7 +1384,7 @@
 
   default:
 
-    log("%s: new_ssl_connection(): Unknown SSL version!\n", prog);
+    log(LOG_ERR, "%s: new_ssl_connection(): Unknown SSL version!\n", prog);
     goto sslerror;
 
   }
@@ -1392,7 +1392,7 @@
   if (ssl->method == NULL ) {
 
     handle_ssl_error("new_ssl_connection()");
-    log("%s: new_ssl_connection(): Cannot initialize SSL method!\n", prog);
+    log(LOG_ERR, "%s: new_ssl_connection(): Cannot initialize SSL method!\n", 
prog);
     goto sslerror;
 
   } 
@@ -1400,7 +1400,7 @@
   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"
+    log(LOG_ERR, "%s: new_ssl_connection(): Cannot initialize SSL server 
certificate"
          " handler!\n", prog);
     goto sslerror;
 
@@ -1412,7 +1412,7 @@
                                     SSL_FILETYPE_PEM) <= 0) {
 
       handle_ssl_error("new_ssl_connection()");
-      log("%s: new_ssl_connection(): Cannot initialize SSL server"
+      log(LOG_ERR, "%s: new_ssl_connection(): Cannot initialize SSL server"
            " certificate!\n", prog);
       goto sslerror;
       
@@ -1422,7 +1422,7 @@
                                    SSL_FILETYPE_PEM) <= 0) {
 
       handle_ssl_error("new_ssl_connection()");
-      log("%s: new_ssl_connection(): Cannot initialize SSL server"
+      log(LOG_ERR, "%s: new_ssl_connection(): Cannot initialize SSL server"
            " private key!\n", prog);
       goto sslerror;
 
@@ -1431,7 +1431,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"
+      log(LOG_ERR, "%s: new_ssl_connection(): Private key does not match the"
            " certificate public key!\n", 
            prog);
       goto sslerror;
@@ -1545,7 +1545,7 @@
 
   if ( -1 == stat(ssl_server->clientpemfile, &stat_buf )) {
 
-    log("%s: verify_init(): Cannot stat the SSL pem path '%s' -- %s\n",
+    log(LOG_ERR,"%s: verify_init(): Cannot stat the SSL pem path '%s' -- %s\n",
          prog, Run.httpsslclientpem, STRERROR);
 
     goto end_error;
@@ -1558,14 +1558,14 @@
                                       ssl_server->clientpemfile)) {
 
       handle_ssl_error("verify_init()");
-      log("%s: verify_init(): Error setting verify directory to %s\n", 
+      log(LOG_ERR,"%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", 
+    log(LOG_ERR,"%s: verify_init(): Loaded SSL client pem directory '%s'\n", 
        prog, ssl_server->clientpemfile);
 
     /* Monits server cert for cli support ! */
@@ -1574,14 +1574,14 @@
                                      NULL)) {
 
       handle_ssl_error("verify_init()");
-      log("%s: verify_init(): Error loading verify certificates from %s\n",
+      log(LOG_ERR,"%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", 
+    log(LOG_ERR,"%s: verify_init(): Loaded monit's SSL pem server file 
'%s'\n", 
        prog, ssl_server->pemfile);
 
   } else if (S_ISREG(stat_buf.st_mode)) {
@@ -1591,14 +1591,14 @@
                                      NULL)) {
 
       handle_ssl_error("verify_init()");
-      log("%s: verify_init(): Error loading verify certificates from %s\n",
+      log(LOG_ERR,"%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", 
+    log(LOG_ERR,"%s: verify_init(): Loaded SSL pem client file '%s'\n", 
        prog, ssl_server->clientpemfile);
 
     /* Monits server cert for cli support ! */
@@ -1607,14 +1607,14 @@
                                      NULL)) {
 
       handle_ssl_error("verify_init()");
-      log("%s: verify_init(): Error loading verify certificates from %s\n",
+      log(LOG_ERR,"%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", 
+    log(LOG_ERR,"%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,
@@ -1622,7 +1622,7 @@
 
   } else {
 
-    log("%s: verify_init(): SSL client pem path is no file or directory %s\n",
+    log(LOG_ERR,"%s: verify_init(): SSL client pem path is no file or 
directory %s\n",
          prog, ssl_server->clientpemfile);
 
     goto end_error;
@@ -1670,7 +1670,7 @@
                               &found_cert)!=1) {
 
     handle_ssl_error("verify_callback()");
-    log("%s: verify_callback(): SSL connection rejected. No matching "
+    log(LOG_ERR,"%s: verify_callback(): SSL connection rejected. No matching "
          "certificate found.", prog);
 
     goto reject; 
@@ -1725,7 +1725,7 @@
 
     /* Remote site specified a certificate, but it's not correct */
     
-    log("%s: check_preverify(): SSL connection rejected because"
+    log(LOG_ERR,"%s: check_preverify(): SSL connection rejected because"
          " certificate verification has failed -- Error %i\n", 
          prog, ctx->error);
     return FALSE; /* Reject connection */
@@ -1738,7 +1738,7 @@
     
     /* Let's accept self signed certs for the moment! */
     
-    log("%s: check_preverify(): SSL connection accepted with"
+    log(LOG_ERR,"%s: check_preverify(): SSL connection accepted with"
        " self signed certificate!\n", prog);
 
     ctx->error=0;
@@ -1751,7 +1751,7 @@
     
     /* Let's accept any purpose certs for the moment! */
     
-    log("%s: check_preverify(): SSL connection accepted "
+    log(LOG_ERR,"%s: check_preverify(): SSL connection accepted "
        "with invalid purpose!\n", prog);
 
     ctx->error=0;
@@ -1759,7 +1759,7 @@
 
   } 
     
-  log("%s: check_preverify(): SSL connection rejected because "
+  log(LOG_ERR,"%s: check_preverify(): SSL connection rejected because "
        "certificate verification has failed -- Error %i!\n", 
        prog, ctx->error);
   return FALSE; /* Reject connection */
@@ -1775,7 +1775,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, 
+  log(LOG_ERR,"%s: verify_info(): Found %d client certificates\n", prog, 
       sk_X509_NAME_num(stack));
   
 }
@@ -1899,18 +1899,18 @@
       if (can_read(ssl->socket, timeout))
           return TRUE;
       else
-          log("%s: %s: Openssl read timeout error!\n", prog, operation);
+          log(LOG_ERR,"%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);
+          log(LOG_ERR,"%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, 
+    log(LOG_ERR,"%s: %s: Openssl syscall error: %s!\n", prog, operation, 
          STRERROR);
     return FALSE;
 
@@ -1919,7 +1919,7 @@
     return FALSE;
       
   default:
-    log("%s: %s: Openssl error!\n", prog, operation);
+    log(LOG_ERR,"%s: %s: Openssl error!\n", prog, operation);
 
   }
 
@@ -1932,7 +1932,7 @@
  */
 static void handle_ssl_error(char *operation) {
 
-  log("%s: %s: Openssl engine error: %s\n", prog, operation, SSLERROR);
+  log(LOG_ERR,"%s: %s: Openssl engine error: %s\n", prog, operation, SSLERROR);
 
 }
 
diff -ruN monit-4.5/state.c monit-4.5.mine/state.c
--- monit-4.5/state.c   2005-02-16 22:57:24.000000000 +0100
+++ monit-4.5.mine/state.c      2006-02-15 15:19:30.978994824 +0100
@@ -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",
+    log(LOG_ERR, "%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 "
+      log(LOG_ERR, "%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",
+    log(LOG_ERR, "%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",
+       log(LOG_ERR, "%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",
+    log(LOG_ERR, "%s: Cannot open the monit state file '%s' -- %s\n",
        prog, Run.statefile, STRERROR);
     
     return NULL;
diff -ruN monit-4.5/status.c monit-4.5.mine/status.c
--- monit-4.5/status.c  2005-01-06 21:51:49.000000000 +0100
+++ monit-4.5.mine/status.c     2006-02-15 15:19:30.978994824 +0100
@@ -81,7 +81,7 @@
                              Run.httpdport, SOCKET_TCP, Run.httpdssl,
                               NET_TIMEOUT);
     if(!sock) {
-      log("%s: error connecting to the monit daemon\n", prog);
+      log(LOG_ERR, "%s: error connecting to the monit daemon\n", prog);
       return;
     } else {
       char buf[LINE];
@@ -100,7 +100,7 @@
          status= TRUE;
       }
       if(!status) {
-       log("%s: cannot read status from the monit daemon\n", prog);
+       log(LOG_ERR, "%s: cannot read status from the monit daemon\n", prog);
        goto error;
       }
       while(socket_readln(sock, buf, LINE)) {
@@ -110,7 +110,7 @@
       socket_free(&sock);
     }
   } else {
-    log("%s: no status available -- the monit daemon is not running\n", prog);
+    log(LOG_INFO, "%s: no status available -- the monit daemon is not 
running\n", prog);
   }
   
 }
diff -ruN monit-4.5/util.c monit-4.5.mine/util.c
--- monit-4.5/util.c    2005-03-26 08:38:18.000000000 +0100
+++ monit-4.5.mine/util.c       2006-02-15 15:19:30.979994672 +0100
@@ -993,18 +993,18 @@
     return(FALSE);
   }
   if(! File_isFile(pidfile)) {
-    log("%s: pidfile '%s' is not a regular file\n",prog, pidfile);
+    log(LOG_ERR, "%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",
+    log(LOG_ERR, "%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",
+    log(LOG_ERR, "%s: pidfile `%s' does not contain a valid pidnumber\n",
        prog, pidfile);
     return (FALSE);
   }
@@ -1256,7 +1256,7 @@
              c->uname,
              c->passwd);
     if(! (b64= encode_base64(strlen(buf), (unsigned char *)buf)) ) {
-      log("Failed to base64 encode authentication header\n");
+      log(LOG_ERR, "Failed to base64 encode authentication header\n");
       FREE(b64);
       return NULL;
     }
@@ -1266,7 +1266,7 @@
     return auth;
   }
 
-  log("Cleattext credentials needed for basic authorization!\n");
+  log(LOG_ERR, "Cleattext credentials needed for basic authorization!\n");
   return NULL;
 
 }
@@ -1348,7 +1348,7 @@
   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);
+      log(LOG_ERR, "Cannot reopen standard file descriptor (%d) -- %s\n", i, 
STRERROR);
     }
   }
 }
@@ -1427,7 +1427,7 @@
       ASSERT(temp);
       *temp= '\0';
       if (md5_crypt(outside, id, salt, outside_crypt, STRLEN) == NULL) {
-       log("Cannot generate MD5 digest error.\n");
+       log(LOG_ERR, "Cannot generate MD5 digest error.\n");
        return FALSE;
       }
       break;
@@ -1442,7 +1442,7 @@
       break;
     }
   default:
-    log("Unknown password digestion method.\n");
+    log(LOG_ERR, "Unknown password digestion method.\n");
     return FALSE;
   }
 
@@ -1596,7 +1596,7 @@
          return TRUE;
       break;
   default:
-      log("Unknown comparison operator\n");
+      log(LOG_ERR, "Unknown comparison operator\n");
       return FALSE;
   }
 
@@ -1617,7 +1617,7 @@
   s->nstart= 0;
   s->ncycle= 0;
   Util_resetInfo(s);
-  DEBUG("Monitoring disabled -- service %s\n", s->name);
+  DEBUG(LOG_DEBUG, "Monitoring disabled -- service %s\n", s->name);
 
 }
 
diff -ruN monit-4.5/validate.c monit-4.5.mine/validate.c
--- monit-4.5/validate.c        2005-03-14 23:30:14.000000000 +0100
+++ monit-4.5.mine/validate.c   2006-02-15 15:19:30.980994520 +0100
@@ -135,7 +135,7 @@
   if(Run.doprocess) {
     initprocesstree(&ptree, &ptreesize, &oldptree, &oldptreesize);
     if(! update_system_load(ptree, ptreesize))
-      log("Update of system load has failed!\n");
+      log(LOG_ERR, "Update of system load has failed!\n");
   }
   time(&systeminfo.collected);
 
@@ -199,7 +199,7 @@
         check_process_resources(s, pr);
       }
     } else {
-      log("'%s' failed to get service data\n", s->name);
+      log(LOG_ERR, "'%s' failed to get service data\n", s->name);
     }
 
   }
@@ -400,12 +400,12 @@
 
         if(icmp->response < 0) {
           icmp->is_available= FALSE;
-          DEBUG("'%s' icmp ping failed\n", s->name);
+          DEBUG(LOG_DEBUG,"'%s' icmp ping failed\n", s->name);
           Event_post(s, EVENT_ICMP, TRUE, icmp->action,
             "'%s' failed ICMP test [%s]", s->name, icmpnames[icmp->type]);
         } else {
           icmp->is_available= TRUE;
-          DEBUG("'%s' icmp ping succeeded [response time %.3fs]\n",
+          DEBUG(LOG_DEBUG,"'%s' icmp ping succeeded [response time %.3fs]\n",
             s->name, icmp->response);
           Event_post(s, EVENT_ICMP, FALSE, icmp->action,
             "'%s' passed ICMP test [%s]", s->name, icmpnames[icmp->type]);
@@ -413,7 +413,7 @@
         break;
 
       default:
-        log("'%s' error -- unknown ICMP type: [%d]\n", s->name, icmp->type);
+        log(LOG_ERR, "'%s' error -- unknown ICMP type: [%d]\n", s->name, 
icmp->type);
         return FALSE;
 
       }
@@ -460,7 +460,7 @@
     rv= FALSE;
     goto error;
   } else {
-    DEBUG("'%s' succeeded connecting to %s\n",
+    DEBUG(LOG_DEBUG,"'%s' succeeded connecting to %s\n",
       s->name, p->address);
   }
 
@@ -481,7 +481,7 @@
     rv= FALSE;
     goto error;
   } else {
-    DEBUG("'%s' succeeded testing protocol [%s] at %s\n",
+    DEBUG(LOG_DEBUG,"'%s' succeeded testing protocol [%s] at %s\n",
           s->name, p->protocol->name, p->address);
   }
 
@@ -521,7 +521,7 @@
     Event_post(s, EVENT_DATA, TRUE, s->action_DATA,
       "'%s' process with pid %d is a zombie", s->name, s->inf->pid);
   } else {
-    DEBUG("'%s' zombie check passed [status_flag=%04x]\n",
+    DEBUG(LOG_DEBUG,"'%s' zombie check passed [status_flag=%04x]\n",
       s->name,  s->inf->status_flag);
     Event_post(s, EVENT_DATA, FALSE, s->action_DATA,
       "'%s' check process state passed", s->name);
@@ -591,7 +591,7 @@
         pr->limit/10.0);
       okay= FALSE;
     } else {
-      DEBUG("'%s' cpu usage check passed [current cpu usage=%.1f%%]\n",
+      DEBUG(LOG_DEBUG,"'%s' cpu usage check passed [current cpu 
usage=%.1f%%]\n",
         s->name, s->inf->cpu_percent/10.0);
     }
     break;
@@ -604,7 +604,7 @@
         pr->limit/10.0);
       okay= FALSE;
     } else {
-      DEBUG("'%s' mem usage check passed [current mem usage=%.1f%%]\n",
+      DEBUG(LOG_DEBUG,"'%s' mem usage check passed [current mem 
usage=%.1f%%]\n",
         s->name, s->inf->mem_percent/10.0);
     }
     break;
@@ -616,7 +616,7 @@
         s->name, s->inf->mem_kbyte, operatorshortnames[pr->operator], 
pr->limit);
       okay= FALSE;
     } else {
-      DEBUG("'%s' mem amount check passed [current mem amount=%ldkB]\n",
+      DEBUG(LOG_DEBUG,"'%s' mem amount check passed [current mem 
amount=%ldkB]\n",
         s->name, s->inf->mem_kbyte);
     }
     break;
@@ -631,7 +631,7 @@
         pr->limit/10.0);
       okay= FALSE;
     } else {
-      DEBUG("'%s' loadavg(1min) check passed [current loadavg(1min)=%.1f]\n",
+      DEBUG(LOG_DEBUG,"'%s' loadavg(1min) check passed [current 
loadavg(1min)=%.1f]\n",
         s->name, systeminfo.loadavg[0]);
     }
     break;
@@ -646,7 +646,7 @@
         pr->limit/10.0);
       okay= FALSE;
     } else {
-      DEBUG("'%s' loadavg(5min) check passed [current loadavg(5min)=%.1f]\n",
+      DEBUG(LOG_DEBUG,"'%s' loadavg(5min) check passed [current 
loadavg(5min)=%.1f]\n",
         s->name, systeminfo.loadavg[1]);
     }
     break;
@@ -661,7 +661,7 @@
         pr->limit/10.0);
       okay= FALSE;
     } else {
-      DEBUG("'%s' loadavg(15min) check passed [current loadavg(15min)=%.1f]\n",
+      DEBUG(LOG_DEBUG,"'%s' loadavg(15min) check passed [current 
loadavg(15min)=%.1f]\n",
         s->name, systeminfo.loadavg[2]);
     }
     break;
@@ -673,7 +673,7 @@
         s->name, s->inf->children, operatorshortnames[pr->operator], 
pr->limit);
       okay= FALSE;
     } else {
-      DEBUG("'%s' children check passed [current children=%i]\n",
+      DEBUG(LOG_DEBUG,"'%s' children check passed [current children=%i]\n",
         s->name, s->inf->children);
     }
     break;
@@ -687,7 +687,7 @@
         pr->limit);
       okay= FALSE;
     } else {
-      DEBUG("'%s' total mem amount check passed "
+      DEBUG(LOG_DEBUG,"'%s' total mem amount check passed "
         "[current total mem amount=%ldkB]\n", s->name, 
s->inf->total_mem_kbyte);
     }
     break;
@@ -701,14 +701,14 @@
         operatorshortnames[pr->operator], (float)pr->limit/10.0);
       okay= FALSE;
     } else {
-      DEBUG("'%s' total mem amount check passed "
+      DEBUG(LOG_DEBUG,"'%s' total mem amount check passed "
         "[current total mem amount=%.1f%%]\n", s->name,
          s->inf->total_mem_percent/10.0);
     }
     break;
 
   default:
-    log("'%s' error -- unknown resource ID: [%d]\n", s->name, pr->resource_id);
+    log(LOG_ERR, "'%s' error -- unknown resource ID: [%d]\n", s->name, 
pr->resource_id);
     return;
   }
 
@@ -757,7 +757,7 @@
         changed= strncmp(cs->hash, s->inf->cs_sum, 40);
         break;
       default:
-        log("'%s' unknown hash type\n", s->name);
+        log(LOG_ERR, "'%s' unknown hash type\n", s->name);
         FREE(s->inf->cs_sum);
         return;
     }
@@ -779,13 +779,13 @@
 
     } else if(cs->test_changes) {
 
-      DEBUG("'%s' checksum has not changed\n", s->name);
+      DEBUG(LOG_DEBUG,"'%s' checksum has not changed\n", s->name);
       Event_post(s, EVENT_CHANGED, FALSE, cs->action,
         "'%s' checksum has not changed", s->name);
 
     } else {
 
-      DEBUG("'%s' has valid checksums\n", s->name);
+      DEBUG(LOG_DEBUG,"'%s' has valid checksums\n", s->name);
       Event_post(s, EVENT_CHECKSUM, FALSE, cs->action,
         "'%s' checksum passed", s->name);
 
@@ -813,7 +813,7 @@
       "'%s' permission test failed for %s -- current permission is %o",
       s->name, s->path, s->inf->st_mode&07777);
   } else {
-    DEBUG("'%s' file permission check passed [current permission=%o]\n",
+    DEBUG(LOG_DEBUG,"'%s' file permission check passed [current 
permission=%o]\n",
       s->name, s->inf->st_mode&07777);
     Event_post(s, EVENT_PERMISSION, FALSE, s->perm->action,
       "'%s' permission passed", s->name);
@@ -833,7 +833,7 @@
       "'%s' uid test failed for %s -- current uid is %d",
       s->name, s->path, (int)s->inf->st_uid);
   } else {
-    DEBUG("'%s' device uid check passed [current uid=%d]\n", s->name,
+    DEBUG(LOG_DEBUG,"'%s' device uid check passed [current uid=%d]\n", s->name,
           (int)s->inf->st_uid);
     Event_post(s, EVENT_UID, FALSE, s->uid->action, "'%s' uid passed", 
s->name);
   }
@@ -853,7 +853,7 @@
       "'%s' gid test failed for %s -- current gid is %d",
       s->name, s->path, (int)s->inf->st_gid);
   } else {
-    DEBUG("'%s' device gid check passed [current gid=%d]\n", s->name,
+    DEBUG(LOG_DEBUG,"'%s' device gid check passed [current gid=%d]\n", s->name,
           (int)s->inf->st_gid);
     Event_post(s, EVENT_GID, FALSE, s->gid->action, "'%s' gid passed", 
s->name);
   }
@@ -890,7 +890,7 @@
         /* reset expected value for next cycle */
         t->timestamp= s->inf->timestamp;
       } else {
-        DEBUG("'%s' timestamp was not changed for %s\n", s->name, s->path);
+        DEBUG(LOG_DEBUG,"'%s' timestamp was not changed for %s\n", s->name, 
s->path);
         Event_post(s, EVENT_CHANGED, FALSE, t->action,
           "'%s' timestamp was not changed for %s", s->name, s->path);
       }
@@ -901,7 +901,7 @@
         Event_post(s, EVENT_TIMESTAMP, TRUE, t->action,
           "'%s' timestamp test failed for %s", s->name, s->path);
       } else {
-        DEBUG("'%s' timestamp test passed for %s\n", s->name, s->path); 
+        DEBUG(LOG_DEBUG,"'%s' timestamp test passed for %s\n", s->name, 
s->path); 
         Event_post(s, EVENT_TIMESTAMP, FALSE, t->action,
           "'%s' timestamp passed", s->name);
       }
@@ -929,7 +929,7 @@
         /* reset expected value for next cycle */
         sl->size= s->inf->st_size;
       } else {
-        DEBUG("'%s' size has not changed [current size=%lu B]\n", s->name,
+        DEBUG(LOG_DEBUG,"'%s' size has not changed [current size=%lu B]\n", 
s->name,
               s->inf->st_size);
         Event_post(s, EVENT_CHANGED, FALSE, sl->action,
           "'%s' size was not changed", s->name, s->path);
@@ -943,7 +943,7 @@
         "'%s' size test failed for %s -- current size is %lu B",
         s->name, s->path, s->inf->st_size);
     } else {
-      DEBUG("'%s' file size check passed [current size=%lu B]\n", s->name,
+      DEBUG(LOG_DEBUG,"'%s' file size check passed [current size=%lu B]\n", 
s->name,
             s->inf->st_size);
       Event_post(s, EVENT_SIZE, FALSE, sl->action, "'%s' size passed", 
s->name);
     }
@@ -959,7 +959,7 @@
   ASSERT(s && td);
 
   if( (td->limit_percent < 0) && (td->limit_absolute < 0) ) {
-    log("'%s' error: device limit not set\n", s->name);
+    log(LOG_ERR, "'%s' error: device limit not set\n", s->name);
     return;
   }
 
@@ -967,7 +967,7 @@
 
   case RESOURCE_ID_INODE:
       if(s->inf->f_files <= 0) {
-       DEBUG("'%s' filesystem doesn't support inodes\n", s->name);
+       DEBUG(LOG_DEBUG,"'%s' filesystem doesn't support inodes\n", s->name);
        return;
       }
 
@@ -992,7 +992,7 @@
          return;
        }
       }
-      DEBUG("'%s' inode usage check passed [current inode usage=%.1f%%]\n",
+      DEBUG(LOG_DEBUG,"'%s' inode usage check passed [current inode 
usage=%.1f%%]\n",
            s->name, s->inf->inode_percent/10.);
       Event_post(s, EVENT_RESOURCE, FALSE, td->action,
         "'%s' device resources passed", s->name);
@@ -1021,14 +1021,14 @@
          return;
         }
       }
-      DEBUG("'%s' space usage check passed [current space usage=%.1f%%]\n",
+      DEBUG(LOG_DEBUG,"'%s' space usage check passed [current space 
usage=%.1f%%]\n",
            s->name, s->inf->space_percent/10.);
       Event_post(s, EVENT_RESOURCE, FALSE, td->action,
         "'%s' device resources passed", s->name);
       return;
       
   default:
-      log("'%s' error -- unknown resource type: [%d]\n", s->name, 
td->resource);
+      log(LOG_ERR, "'%s' error -- unknown resource type: [%d]\n", s->name, 
td->resource);
       return;
   }
   
diff -ruN monit-4.5/xmalloc.c monit-4.5.mine/xmalloc.c
--- monit-4.5/xmalloc.c 2005-02-24 21:44:01.000000000 +0100
+++ monit-4.5.mine/xmalloc.c    2006-02-15 15:19:30.980994520 +0100
@@ -69,7 +69,7 @@
 #if ! HAVE_MALLOC
     if ( n == 0) {
 
-      log("%s: passed a broken malloc 0\n", prog);
+      log(LOG_ERR, "%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);
+      log(LOG_ERR, "%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);
+      log(LOG_ERR, "%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);
+    log(LOG_ERR, "%s: realloc failed -- %s\n", prog, STRERROR);
     exit(1);
     
   }


reply via email to

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