[OpenAFS-devel] bosserver cleanup

Christof Hanke hanke@rzg.mpg.de
Wed, 01 Feb 2006 17:07:38 +0100


This is a multi-part message in MIME format.
--------------020402030505040206080406
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I'm about to pthread the bosserver, but beforehand I thought, a little
code cleanup might be helpful.
The patch deals mostly with the logging.
You can also find it under 
/afs/ipp-garching.mpg.de/home/h/hanke/public/openafs/bozo-patch

Anybody else already working on the ptheaded bozo ?

Hope it helps.
Christof



--------------020402030505040206080406
Content-Type: text/plain;
 name="bozo-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="bozo-patch"

--- bozo/bosserver.c	2005-07-11 21:08:36.000000000 +0200
+++ bozo_new/bosserver.c	2006-01-23 13:50:24.000000000 +0100
@@ -37,6 +37,7 @@
 #include <rx/rx_globals.h>
 #include "bosint.h"
 #include "bnode.h"
+#include "bosolog.h"
 #include <afs/auth.h>
 #include <afs/keys.h>
 #include <afs/ktime.h>
@@ -46,6 +47,7 @@
 #if defined(AFS_SGI_ENV)
 #include <afs/afs_args.h>
 #endif
+#include <afs/assert.h>
 
 
 #define BOZO_LWP_STACKSIZE	16000
@@ -53,24 +55,20 @@
 extern int RXSTATS_ExecuteRequest();
 extern struct bnode_ops fsbnode_ops, ezbnode_ops, cronbnode_ops;
 
-void bozo_Log();
-
 struct afsconf_dir *bozo_confdir = 0;	/* bozo configuration dir */
 static char *bozo_pid;
 struct rx_securityClass *bozo_rxsc[3];
 const char *bozo_fileName;
-FILE *bozo_logFile;
 
-int DoLogging = 0;
-int DoSyslog = 0;
-#ifndef AFS_NT40_ENV
-int DoSyslogFacility = LOG_DAEMON;
-#endif
+
 static afs_int32 nextRestart;
 static afs_int32 nextDay;
 
 struct ktime bozo_nextRestartKT, bozo_nextDayKT;
 int bozo_newKTs;
+
+void Terminate(int code);
+
 #ifdef BOS_RESTRICTED_MODE
 int bozo_isrestricted = 0;
 int bozo_restdisable = 0;
@@ -108,10 +106,10 @@
 	status |= BOSEXIT_NOAUTH_FLAG;
     }
     /* if logging is on, pass "-log" to new bosserver */
-    if (DoLogging) {
-	status |= BOSEXIT_LOGGING_FLAG;
-    }
-    exit(status);
+	 if (getLoggingMode() == BOZO_DO_FILE_LOGGING)
+	    status |= BOSEXIT_LOGGING_FLAG;
+
+    Terminate(status);
 #else
     /* exec new bosserver process */
     char *argv[4];
@@ -126,16 +124,16 @@
 	i++;
     }
     /* if logging is on, pass "-log" to new bosserver */
-    if (DoLogging) {
+    if (getLoggingMode() == BOZO_DO_FILE_LOGGING) {
 	argv[i] = "-log";
 	i++;
     }
 #ifndef AFS_NT40_ENV
     /* if syslog logging is on, pass "-syslog" to new bosserver */
-    if (DoSyslog) {
+    if (getLoggingMode() == BOZO_DO_SYS_LOGGING) {
 	char *arg = (char *)malloc(40);	/* enough for -syslog=# */
-	if (DoSyslogFacility != LOG_DAEMON) {
-	    snprintf(arg, 40, "-syslog=%d", DoSyslogFacility);
+	if (getLogFacility() != LOG_DAEMON) {
+	    snprintf(arg, 40, "-syslog=%d", getLogFacility() );
 	} else {
 	    strcpy(arg, "-syslog");
 	}
@@ -152,6 +150,8 @@
 	close(i);
     }
 
+    closeLogging();
+
     execv(argv[0], argv);	/* should not return */
     _exit(1);
 #endif /* AFS_NT40_ENV */
@@ -270,7 +270,7 @@
     char *instp, *typep, *notifier, *notp;
     register afs_int32 code;
     afs_int32 ktmask, ktday, kthour, ktmin, ktsec;
-    afs_int32 i, goal;
+    afs_int32 i, goal,line_no=0;
     struct bnode *tb;
     char *parms[MAXPARMS];
 #ifdef BOS_RESTRICTED_MODE
@@ -323,6 +323,7 @@
     while (1) {
 	/* ok, read lines giving parms and such from the file */
 	tp = fgets(tbuffer, sizeof(tbuffer), tfile);
+	line_no +=1; 
 	if (tp == (char *)0)
 	    break;		/* all done */
 
@@ -349,6 +350,7 @@
 		sscanf(tbuffer, "checkbintime %d %d %d %d %d", &ktmask,
 		       &ktday, &kthour, &ktmin, &ktsec);
 	    if (code != 5) {
+	        BOZO_LOG_2("Parse error at line no %d\n",line_no);
 		code = -1;
 		goto fail;
 	    }
@@ -365,6 +367,7 @@
 	if (strncmp(tbuffer, "restrictmode", 12) == 0) {
 	    code = sscanf(tbuffer, "restrictmode %d", &rmode);
 	    if (code != 1) {
+		BOZO_LOG_2("Parse error at line no %d\n",line_no);
 		code = -1;
 		goto fail;
 	    }
@@ -378,6 +381,7 @@
 #endif
 
 	if (strncmp("bnode", tbuffer, 5) != 0) {
+	    BOZO_LOG_2("Parse error at line no %d\n",line_no);
 	    code = -1;
 	    goto fail;
 	}
@@ -386,6 +390,7 @@
 	    sscanf(tbuffer, "bnode %s %s %d %s", typep, instp, &goal,
 		   notifier);
 	if (code < 3) {
+	    BOZO_LOG_2("Parse error at line no %d\n",line_no);
 	    code = -1;
 	    goto fail;
 	} else if (code == 3)
@@ -394,7 +399,9 @@
 	for (i = 0; i < MAXPARMS; i++) {
 	    /* now read the parms, until we see an "end" line */
 	    tp = fgets(tbuffer, sizeof(tbuffer), tfile);
+	    line_no +=1;
 	    if (!tp) {
+		BOZO_LOG_1("Incomplete bnode definition!\n");
 		code = -1;
 		goto fail;
 	    }
@@ -403,6 +410,7 @@
 		break;
 	    if (strncmp(tbuffer, "parm ", 5)) {
 		code = -1;
+		BOZO_LOG_2("Parse error at line no %d\n",line_no);
 		goto fail;	/* no "parm " either */
 	    }
 	    if (!parms[i])	/* make sure there's space */
@@ -522,7 +530,7 @@
 
 #ifdef BOS_RESTRICTED_MODE
 	if (bozo_restdisable) {
-	    bozo_Log("Restricted mode disabled by signal\n");
+	    BOZO_LOG_1("Restricted mode disabled by signal\n");
 	    bozo_restdisable = 0;
 	}
 #endif
@@ -717,7 +725,6 @@
     int noAuth = 0;
     struct ktc_encryptionKey tkey;
     int i;
-    char namebuf[AFSDIR_PATH_MAX];
 #ifndef AFS_NT40_ENV
     int nofork = 0;
     struct stat sb;
@@ -776,7 +783,7 @@
 #if defined(AFS_SGI_ENV)
     /* offer some protection if AFS isn't loaded */
     if (syscall(AFS_SYSCALL, AFSOP_ENDLOG) < 0 && errno == ENOPKG) {
-	printf("bosserver: AFS doesn't appear to be configured in O.S..\n");
+	fprintf(stderr,"bosserver: AFS doesn't appear to be configured in O.S..\n");
 	exit(1);
     }
 #endif
@@ -788,15 +795,15 @@
 	    noAuth = 1;
 	} else if (strcmp(argv[code], "-log") == 0) {
 	    /* set extra logging flag */
-	    DoLogging = 1;
+	    setLoggingMode(BOZO_DO_FILE_LOGGING);
 	}
 #ifndef AFS_NT40_ENV
 	else if (strcmp(argv[code], "-syslog") == 0) {
 	    /* set syslog logging flag */
-	    DoSyslog = 1;
+	    setLoggingMode(BOZO_DO_FILE_LOGGING);
 	} else if (strncmp(argv[code], "-syslog=", 8) == 0) {
-	    DoSyslog = 1;
-	    DoSyslogFacility = atoi(argv[code] + 8);
+	    setLoggingMode(BOZO_DO_SYS_LOGGING);
+	    setLogFacility(atoi(argv[code] + 8));
 	} else if (strcmp(argv[code], "-nofork") == 0) {
 	    nofork = 1;
 	}
@@ -865,14 +872,14 @@
 
 #ifndef AFS_NT40_ENV
     if (geteuid() != 0) {
-	printf("bosserver: must be run as root.\n");
+	fprintf(stderr,"bosserver: must be run as root.\n");
 	exit(1);
     }
 #endif
 
     code = bnode_Init();
     if (code) {
-	printf("bosserver: could not init bnode package, code %d\n", code);
+	fprintf(stderr,"bosserver: could not init bnode package, code %d\n", code);
 	exit(1);
     }
 
@@ -891,57 +898,38 @@
     fflush(stdout);
 #endif
 
-    /* go into the background and remove our controlling tty, close open 
-       file desriptors
-     */
-
-#ifndef AFS_NT40_ENV
-    if (!nofork)
-	daemon(1, 0);
-#endif /* ! AFS_NT40_ENV */
-
-    if ((!DoSyslog)
-#ifndef AFS_NT40_ENV
-	&& ((lstat(AFSDIR_BOZLOG_FILE, &sb) == 0) && 
-	!(S_ISFIFO(sb.st_mode)))
-#endif
-	) {
-	strcpy(namebuf, AFSDIR_BOZLOG_FILE);
-	strcat(namebuf, ".old");
-	renamefile(AFSDIR_BOZLOG_FILE, namebuf);	/* try rename first */
-	bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
-	if (!bozo_logFile) {
-	    printf("bosserver: can't initialize log file (%s).\n",
-		   AFSDIR_SERVER_BOZLOG_FILEPATH);
-	    exit(1);
-	}
-	/* keep log closed normally, so can be removed */
-	fclose(bozo_logFile);
-    } else {
-#ifndef AFS_NT40_ENV
-	openlog("bosserver", LOG_PID, DoSyslogFacility);
-#endif
-    }
-
-    /* Write current state of directory permissions to log file */
-    DirAccessOK();
+/* check if we can initialize the socket */
 
     for (i = 0; i < 10; i++) {
 	code = rx_Init(htons(AFSCONF_NANNYPORT));
 	if (code) {
-	    bozo_Log("can't initialize rx: code=%d\n", code);
+	    fprintf(stderr,"can't initialize rx: code=%d\n", code);
 	    sleep(3);
 	} else
 	    break;
     }
     if (i >= 10) {
-	bozo_Log("Bos giving up, can't initialize rx\n");
+	fprintf(stderr,"Bosserver: can't initialize rx, giving up.\n");
 	exit(code);
     }
+    if (initializeLogging()) 
+	exit (1);
 
-    code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
+    /* go into the background and remove our controlling tty, close open 
+       file desriptors
+    */
+#ifndef AFS_NT40_ENV
+    if (!nofork)
+	daemon(1, 0);
+#endif /* ! AFS_NT40_ENV */
+
+    /* Write current state of directory permissions to log file */
+    DirAccessOK();
+
+    BOZO_LOG_1("Starting LWP.\n");
+    assert(LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
 			     (void *) /*parm */ 0, "bozo-the-clown",
-			     &bozo_pid);
+			     &bozo_pid) == 0 );
 
     /* try to read the key from the config file */
     tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
@@ -952,37 +940,35 @@
 	tcell.numServers = 1;
 	code = gethostname(tcell.hostName[0], MAXHOSTCHARS);
 	if (code) {
-	    bozo_Log("failed to get hostname, code %d\n", errno);
-	    exit(1);
+	    BOZO_LOG_2("failed to get hostname, code %d\n", errno);
+	    Terminate(1);
 	}
 	if (tcell.hostName[0][0] == 0) {
-	    bozo_Log("host name not set, can't start\n");
-	    bozo_Log("try the 'hostname' command\n");
-	    exit(1);
+	    BOZO_LOG_1("host name not set, can't start\n");
+	    BOZO_LOG_1("try the 'hostname' command\n");
+	    Terminate(1);
 	}
 	memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr));	/* not computed */
 	code =
 	    afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH,
 				&tcell);
 	if (code) {
-	    bozo_Log
-		("could not create cell database in '%s' (code %d), quitting\n",
+	    BOZO_LOG_3("could not create cell database in '%s' (code %d), quitting\n",
 		 AFSDIR_SERVER_ETC_DIRPATH, code);
-	    exit(1);
+	    Terminate(1);
 	}
 	tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
 	if (!tdir) {
-	    bozo_Log
+	    BOZO_LOG_1
 		("failed to open newly-created cell database, quitting\n");
-	    exit(1);
+	    Terminate(1);
 	}
     }
 
     /* read init file, starting up programs */
     if (code = ReadBozoFile(0)) {
-	bozo_Log
-	    ("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
-	     code, AFSDIR_SERVER_BOZCONF_FILEPATH);
+	
+	BOZO_LOG_3("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",code, AFSDIR_SERVER_BOZCONF_FILEPATH);
 	exit(code);
     }
 
@@ -1022,40 +1008,8 @@
     rx_StartServer(1);		/* donate this process */
 }
 
-void
-bozo_Log(char *a, char *b, char *c, char *d, char *e, char *f)
-{
-    char tdate[26];
-    time_t myTime;
-
-    if (DoSyslog) {
-#ifndef AFS_NT40_ENV
-	syslog(LOG_INFO, a, b, c, d, e, f);
-#endif
-    } else {
-	myTime = time(0);
-	strcpy(tdate, ctime(&myTime));	/* copy out of static area asap */
-	tdate[24] = ':';
-
-	/* log normally closed, so can be removed */
-
-	bozo_logFile = fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
-	if (bozo_logFile == NULL) {
-	    printf("bosserver: WARNING: problem with %s",
-		   AFSDIR_SERVER_BOZLOG_FILEPATH);
-	    fflush(stdout);
-	}
-
-	if (bozo_logFile) {
-	    fprintf(bozo_logFile, "%s ", tdate);
-	    fprintf(bozo_logFile, a, b, c, d, e, f);
-	    fflush(bozo_logFile);
-	} else {
-	    printf("%s ", tdate);
-	    printf(a, b, c, d, e, f);
-	}
-
-	/* close so rm BosLog works */
-	fclose(bozo_logFile);
-    }
+void Terminate(int code) {
+	closeLogging();
+	exit(code);
 }
+
--- bozo/bnode.c	2005-07-11 21:29:32.000000000 +0200
+++ bozo_new/bnode.c	2006-01-23 13:58:32.000000000 +0100
@@ -43,15 +43,20 @@
 #include <afs/afsutil.h>
 #include <afs/fileutil.h>
 #include "bnode.h"
+#include "bosolog.h"
 
 #if defined(AFS_AIX_ENV) || defined(AFS_SUN4_ENV)
 /* All known versions of AIX lack WCOREDUMP but this works */
 #define WCOREDUMP(x) ((x) & 0x80)
 #endif
+#include <afs/assert.h>
 
 #define BNODE_LWP_STACKSIZE	(16 * 1024)
 
+
+
 int bnode_waiting = 0;
+
 static PROCESS bproc_pid;	/* pid of waker-upper */
 static struct bnode *allBnodes = 0;	/* list of all bnodes */
 static struct bnode_proc *allProcs = 0;	/* list of all processes for which we're waiting */
@@ -159,6 +164,7 @@
     if (abnode->flags & BNODE_WAIT) {
 	abnode->flags &= ~BNODE_WAIT;
 	LWP_NoYieldSignal(abnode);
+
     }
     return 0;
 }
@@ -192,6 +198,7 @@
 	    bnode_Release(tb);
 	    goto retry;
 	}
+
 	bnode_Release(tb);
     }
     return 0;
@@ -324,6 +331,7 @@
     char *notifierpath = NULL;
     struct stat tstat;
 
+
     if (bnode_FindInstance(ainstance))
 	return BZEXISTS;
     type = FindType(atype);
@@ -333,13 +341,13 @@
     if (notifier && strcmp(notifier, NONOTIFIER)) {
 	/* construct local path from canonical (wire-format) path */
 	if (ConstructLocalBinPath(notifier, &notifierpath)) {
-	    bozo_Log("BNODE-Create: Notifier program path invalid '%s'\n",
+	    BOZO_LOG_2("BNODE-Create: Notifier program path invalid '%s'\n",
 		     notifier);
 	    return BZNOCREATE;
 	}
 
 	if (stat(notifierpath, &tstat)) {
-	    bozo_Log("BNODE-Create: Notifier program '%s' not found\n",
+	    BOZO_LOG_2("BNODE-Create: Notifier program '%s' not found\n",
 		     notifierpath);
 	    free(notifierpath);
 	    return BZNOCREATE;
@@ -506,7 +514,6 @@
     struct timeval tv;
     int setAny;
     int status;
-
     while (1) {
 	/* first figure out how long to sleep for */
 	temp = 0x7fffffff;	/* afs_int32 time; maxint doesn't work in select */
@@ -587,12 +594,13 @@
 			    RememberProcName(tp);
 			    tb->errorSignal = 0;
 			}
-			if (tp->coreName)
-			    bozo_Log("%s:%s exited with code %d\n", tb->name,
+			if (tp->coreName)  {
+				BOZO_LOG_4("%s:%s exited with code %d\n", tb->name,
 				     tp->coreName, tp->lastExit);
-			else
-			    bozo_Log("%s exited with code %d\n", tb->name,
+			} else {
+			    BOZO_LOG_3("%s exited with code %d\n", tb->name,
 				     tp->lastExit);
+                        }
 		    } else {
 			/* Signal occurred, perhaps spurious due to shutdown request.
 			 * If due to a shutdown request, don't overwrite last error
@@ -607,22 +615,23 @@
 			    tb->lastErrorExit = FT_ApproxTime();
 			    RememberProcName(tp);
 			}
-			if (tp->coreName)
-			    bozo_Log("%s:%s exited on signal %d%s\n",
+			if (tp->coreName) {
+			    BOZO_LOG_5("%s:%s exited on signal %d%s\n",
 				     tb->name, tp->coreName, tp->lastSignal,
 				     WCOREDUMP(status) ? " (core dumped)" :
 				     "");
-			else
-			    bozo_Log("%s exited on signal %d%s\n", tb->name,
+			} else {
+			    BOZO_LOG_4("%s exited on signal %d%s\n", tb->name,
 				     tp->lastSignal,
 				     WCOREDUMP(status) ? " (core dumped)" :
 				     "");
+                        }
 			SaveCore(tb, tp);
 		    }
 		    tb->lastAnyExit = FT_ApproxTime();
 
 		    if (tb->notifier) {
-			bozo_Log("BNODE: Notifier %s will be called\n",
+			BOZO_LOG_2("BNODE: Notifier %s will be called\n",
 				 tb->notifier);
 			hdl_notifier(tp);
 		    }
@@ -633,9 +642,7 @@
 			/* 10 in 10 seconds */
 			tb->flags |= BNODE_ERRORSTOP;
 			bnode_SetGoal(tb, BSTAT_SHUTDOWN);
-			bozo_Log
-			    ("BNODE '%s' repeatedly failed to start, perhaps missing executable.\n",
-			     tb->name);
+			BOZO_LOG_2("BNODE '%s' repeatedly failed to start, perhaps missing executable.\n", tb->name);
 		    }
 		    bnode_Release(tb);	/* bnode delete can happen here */
 		    DeleteProc(tp);
@@ -727,7 +734,7 @@
     struct stat tstat;
 
     if (stat(tp->bnode->notifier, &tstat)) {
-	bozo_Log("BNODE: Failed to find notifier '%s'; ignored\n",
+	BOZO_LOG_2("BNODE: Failed to find notifier '%s'; ignored\n",
 		 tp->bnode->notifier);
 	return (1);
     }
@@ -747,7 +754,7 @@
 #endif
 	fout = popen(tb->notifier, "w");
 	if (fout == NULL) {
-	    bozo_Log("BNODE: Failed to find notifier '%s'; ignored\n",
+	    BOZO_LOG_2("BNODE: Failed to find notifier '%s'; ignored\n",
 		     tb->notifier);
 	    perror(tb->notifier);
 	    exit(1);
@@ -756,7 +763,7 @@
 	pclose(fout);
 	exit(0);
     } else if (pid < 0) {
-	bozo_Log("Failed to fork creating process to handle notifier '%s'\n",
+	BOZO_LOG_2("Failed to fork creating process to handle notifier '%s'\n",
 		 tp->bnode->notifier);
 	return -1;
     }
@@ -780,7 +787,6 @@
 bnode_Int(int asignal)
 {
     extern void bozo_ShutdownAndExit();
-
     if (asignal == SIGQUIT) {
 	IOMGR_SoftSig(bozo_ShutdownAndExit, (char *)asignal);
     } else {
@@ -804,11 +810,9 @@
     memset(&bnode_stats, 0, sizeof(bnode_stats));
     LWP_InitializeProcessSupport(1, &junk);	/* just in case */
     IOMGR_Initialize();
-    code = LWP_CreateProcess(bproc, BNODE_LWP_STACKSIZE,
+    assert(LWP_CreateProcess(bproc, BNODE_LWP_STACKSIZE,
 			     /* priority */ 1, (void *) /* parm */ 0,
-			     "bnode-manager", &bproc_pid);
-    if (code)
-	return code;
+			     "bnode-manager", &bproc_pid) == 0);
     memset((char *)&newaction, 0, sizeof(newaction));
     newaction.sa_handler = bnode_Int;
     code = sigaction(SIGCHLD, &newaction, NULL);
@@ -930,7 +934,7 @@
     osi_audit(BOSSpawnProcEvent, 0, AUD_STR, aexecString, AUD_END);
 
     if (cpid == (pid_t) - 1) {
-	bozo_Log("Failed to spawn process for bnode '%s'\n", abnode->name);
+	BOZO_LOG_2("Failed to spawn process for bnode '%s'\n", abnode->name);
 	bnode_FreeTokens(tlist);
 	free(tp);
 	return errno;
--- bozo/cronbnodeops.c	2003-12-07 23:49:18.000000000 +0100
+++ bozo_new/cronbnodeops.c	2006-01-23 11:53:56.000000000 +0100
@@ -36,6 +36,7 @@
 #include <afs/afsutil.h>
 #include <afs/procmgmt.h>	/* signal(), kill(), wait(), etc. */
 #include "bnode.h"
+#include "bosolog.h"
 
 static int cron_timeout(), cron_getstat(), cron_setstat(), cron_delete();
 static int cron_procexit(), cron_getstring(), cron_getparm(), cron_restartp();
@@ -116,7 +117,7 @@
 	    abnode->lastStart = FT_ApproxTime();
 	    code = bnode_NewProc(abnode, abnode->command, NULL, &tp);
 	    if (code) {
-		bozo_Log("cron bnode %s failed to start (code %d)\n",
+		BOZO_LOG_3("cron bnode %s failed to start (code %d)\n",
 			 abnode->b.name, code);
 		return code;
 	    }
@@ -163,7 +164,7 @@
 
     /* construct local path from canonical (wire-format) path */
     if (ConstructLocalBinPath(acommand, &cmdpath)) {
-	bozo_Log("BNODE: command path invalid '%s'\n", acommand);
+	BOZO_LOG_2("BNODE: command path invalid '%s'\n", acommand);
 	return NULL;
     }
 
@@ -199,7 +200,7 @@
 	    bnode_SetTimeout(abnode, 0);
 	    code = bnode_NewProc(abnode, abnode->command, NULL, &tp);
 	    if (code) {
-		bozo_Log("cron failed to start bnode %s (code %d)\n",
+		BOZO_LOG_3("cron failed to start bnode %s (code %d)\n",
 			 abnode->b.name, code);
 		return code;
 	    }
@@ -279,11 +280,11 @@
 
     /* log interesting errors for folks */
     if (aproc->lastSignal)
-	bozo_Log("cron job %s exited due to signal %d\n", abnode->b.name,
-		 aproc->lastSignal);
+	BOZO_LOG_3("cron job %s exited due to signal %d\n", abnode->b.name,
+		 aproc->lastSignal)
     else if (aproc->lastExit)
-	bozo_Log("cron job %s exited with non-zero code %d\n", abnode->b.name,
-		 aproc->lastExit);
+	BOZO_LOG_3("cron job %s exited with non-zero code %d\n", abnode->b.name,
+		 aproc->lastExit)
 
     abnode->waitingForShutdown = 0;
     abnode->running = 0;
--- bozo/ezbnodeops.c	2003-07-16 01:14:43.000000000 +0200
+++ bozo_new/ezbnodeops.c	2006-01-23 11:53:56.000000000 +0100
@@ -33,6 +33,7 @@
 #include <afs/afsutil.h>
 #include <afs/procmgmt.h>	/* signal(), kill(), wait(), etc. */
 #include "bnode.h"
+#include "bosolog.h"
 
 static int ez_timeout(), ez_getstat(), ez_setstat(), ez_delete();
 static int ez_procexit(), ez_getstring(), ez_getparm(), ez_restartp();
@@ -106,7 +107,7 @@
     char *cmdpath;
 
     if (ConstructLocalBinPath(acommand, &cmdpath)) {
-	bozo_Log("BNODE: command path invalid '%s'\n", acommand);
+	BOZO_LOG_2("BNODE: command path invalid '%s'\n", acommand);
 	return NULL;
     }
 
--- bozo/fsbnodeops.c	2003-12-07 23:49:18.000000000 +0100
+++ bozo_new/fsbnodeops.c	2006-01-23 11:53:56.000000000 +0100
@@ -40,6 +40,7 @@
 #include <afs/procmgmt.h>	/* signal(), kill(), wait(), etc. */
 #include <afs/afsutil.h>
 #include "bnode.h"
+#include "bosolog.h"
 
 static int fs_timeout(), fs_getstat(), fs_setstat(), fs_delete();
 static int fs_procexit(), fs_getstring(), fs_getparm(), fs_restartp();
@@ -308,21 +309,21 @@
 
     /* construct local paths from canonical (wire-format) paths */
     if (ConstructLocalBinPath(afilecmd, &fileCmdpath)) {
-	bozo_Log("BNODE: command path invalid '%s'\n", afilecmd);
+	BOZO_LOG_2("BNODE: command path invalid '%s'\n", afilecmd);
 	bailout = 1;
     }
     if (ConstructLocalBinPath(avolcmd, &volCmdpath)) {
-	bozo_Log("BNODE: command path invalid '%s'\n", avolcmd);
+	BOZO_LOG_2("BNODE: command path invalid '%s'\n", avolcmd);
 	bailout = 1;
     }
     if (ConstructLocalBinPath(asalcmd, &salCmdpath)) {
-	bozo_Log("BNODE: command path invalid '%s'\n", asalcmd);
+	BOZO_LOG_2("BNODE: command path invalid '%s'\n", asalcmd);
 	bailout = 1;
     }
 
     if (ascancmd && strlen(ascancmd)) {
 	if (ConstructLocalBinPath(ascancmd, &scanCmdpath)) {
-	    bozo_Log("BNODE: command path invalid '%s'\n", ascancmd);
+	    BOZO_LOG_2("BNODE: command path invalid '%s'\n", ascancmd);
 	    bailout = 1;
 	}
     }
@@ -333,7 +334,7 @@
 	AppendExecutableExtension(cmdname);
 #endif
 	if (stat(cmdname, &tstat)) {
-	    bozo_Log("BNODE: file server binary '%s' not found\n", cmdname);
+	    BOZO_LOG_2("BNODE: file server binary '%s' not found\n", cmdname);
 	    bailout = 1;
 	}
 
@@ -342,7 +343,7 @@
 	AppendExecutableExtension(cmdname);
 #endif
 	if (stat(cmdname, &tstat)) {
-	    bozo_Log("BNODE: volume server binary '%s' not found\n", cmdname);
+	    BOZO_LOG_2("BNODE: volume server binary '%s' not found\n", cmdname);
 	    bailout = 1;
 	}
 
@@ -351,7 +352,7 @@
 	AppendExecutableExtension(cmdname);
 #endif
 	if (stat(cmdname, &tstat)) {
-	    bozo_Log("BNODE: salvager binary '%s' not found\n", cmdname);
+	    BOZO_LOG_2("BNODE: salvager binary '%s' not found\n", cmdname);
 	    bailout = 1;
 	}
 
@@ -361,7 +362,7 @@
 	    AppendExecutableExtension(cmdname);
 #endif
 	    if (stat(cmdname, &tstat)) {
-		bozo_Log("BNODE: scanner binary '%s' not found\n", cmdname);
+		BOZO_LOG_2("BNODE: scanner binary '%s' not found\n", cmdname);
 		bailout = 1;
 	    }
 	}
@@ -408,7 +409,7 @@
 	if (!abnode->volKillSent && now - abnode->timeSDStarted > SDTIME) {
 	    bnode_StopProc(abnode->volProc, SIGKILL);
 	    abnode->volKillSent = 1;
-	    bozo_Log
+	    BOZO_LOG_2
 		("bos shutdown: volserver failed to shutdown within %d seconds\n",
 		 SDTIME);
 	}
@@ -417,7 +418,7 @@
 	if (!abnode->salKillSent && now - abnode->timeSDStarted > SDTIME) {
 	    bnode_StopProc(abnode->salProc, SIGKILL);
 	    abnode->salKillSent = 1;
-	    bozo_Log
+	    BOZO_LOG_2
 		("bos shutdown: salvager failed to shutdown within %d seconds\n",
 		 SDTIME);
 	}
@@ -426,7 +427,7 @@
 	if (!abnode->fileKillSent && now - abnode->timeSDStarted > FSSDTIME) {
 	    bnode_StopProc(abnode->fileProc, SIGKILL);
 	    abnode->fileKillSent = 1;
-	    bozo_Log
+	    BOZO_LOG_2
 		("bos shutdown: fileserver failed to shutdown within %d seconds\n",
 		 FSSDTIME);
 	}
@@ -435,7 +436,7 @@
 	if (!abnode->scanKillSent && now - abnode->timeSDStarted > SDTIME) {
 	    bnode_StopProc(abnode->scanProc, SIGKILL);
 	    abnode->scanKillSent = 1;
-	    bozo_Log
+	    BOZO_LOG_2
 		("bos shutdown: scanner failed to shutdown within %d seconds\n",
 		 SDTIME);
 	}
@@ -546,8 +547,8 @@
 	 * tells us if we need to run the salvager or not */
 	if (abnode->fileRunning) {
 	    if (abnode->salRunning) {
-		bozo_Log("Salvager running along with file server!\n");
-		bozo_Log("Emergency shutdown\n");
+		BOZO_LOG_1("Salvager running along with file server!\n");
+		BOZO_LOG_1("Emergency shutdown\n");
 		emergency = 1;
 		bnode_SetGoal(abnode, BSTAT_SHUTDOWN);
 		bnode_StopProc(abnode->salProc, SIGKILL);
--- bozo/Makefile.in	2003-06-27 16:12:06.000000000 +0200
+++ bozo_new/Makefile.in	2006-01-23 14:01:36.000000000 +0100
@@ -37,7 +37,7 @@
 	${TOP_LIBDIR}/libprocmgmt.a
 
 OBJS=bosserver.o bnode.o ezbnodeops.o fsbnodeops.o bosint.ss.o bosint.xdr.o \
-bosoprocs.o cronbnodeops.o
+bosoprocs.o bosolog.o cronbnodeops.o
 
 all: bosserver ${TOP_INCDIR}/afs/bosint.h bos ${TOP_LIBDIR}/libbos.a ${TOP_INCDIR}/afs/bnode.h bos_util
 
@@ -75,6 +75,8 @@
 
 bosoprocs.o: bosoprocs.c ${INCLS}
 
+bosolog.o: bosolog.c ${INCLS}
+
 bos.o: bos.c ${INCLS} AFS_component_version_number.o
 
 bos: bos.o $(LIBS) libbos.a
--- bozo/bosolog.h	2006-01-23 13:45:16.000000000 +0100
+++ bozo_new/bosolog.h	2006-01-23 11:53:55.000000000 +0100
@@ -0,0 +1,43 @@
+#ifndef BOZO_LOGH
+#define BOZO_LOGH 1
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <afs/dirpath.h>
+#include <string.h>
+#include <time.h>
+#ifndef AFS_NT40_ENV
+#include <syslog.h>
+#endif /* AFS_NT40_ENV */
+
+#define BOZO_LOG_MSGLEN 1024
+#define BOZO_DO_FILE_LOGGING        0x01
+#define BOZO_DO_SYS_LOGGING     0x02
+#define BOZO_MAX_LOGGING_MODE  0x02
+#define BOZO_FILELOG_RENAME_TIMEFORMAT "-%Y-%m-%d-%H:%M"
+#define BOZO_LOG_1(a)  {snprintf(BOZO_msgbuf,BOZO_LOG_MSGLEN,(a)); \
+    bozo_Log(BOZO_msgbuf);}
+#define BOZO_LOG_2(a,b)  {snprintf(BOZO_msgbuf,BOZO_LOG_MSGLEN,(a),(b)); \
+    bozo_Log(BOZO_msgbuf);}
+#define BOZO_LOG_3(a,b,c)  {snprintf(BOZO_msgbuf,BOZO_LOG_MSGLEN,(a),(b),(c)); \
+    bozo_Log(BOZO_msgbuf);}
+#define BOZO_LOG_4(a,b,c,d)  {snprintf(BOZO_msgbuf,BOZO_LOG_MSGLEN,(a),(b),(c),(d)); \
+    bozo_Log(BOZO_msgbuf);}
+#define BOZO_LOG_5(a,b,c,d,e)  {snprintf(BOZO_msgbuf,BOZO_LOG_MSGLEN,(a),(b),(c),(d),(e)); \
+    bozo_Log(BOZO_msgbuf);}
+#define BOZO_LOG_6(a,b,c,d,e,f)  {snprintf(BOZO_msgbuf,BOZO_LOG_MSGLEN,(a),(b),(c),(d),(e),(f)); \
+    bozo_Log(BOZO_msgbuf);}
+#define BOZO_WAS_HERE {snprintf(BOZO_msgbuf,BOZO_LOG_MSGLEN,"Checkpoint in file %s, at line %d\n", __FILE__, __LINE__); \
+    bozo_Log(BOZO_msgbuf);}
+
+/* The BOZO_LOG Makros have to be protected somehow in PThread stuff!*/
+void bozo_Log(char *msg);
+int getLoggingMode();
+int setLoggingMode(int Mode);
+int getLogFacility();
+int setLogFacility(int);
+int initializeLogging();
+void closeLogging();
+char BOZO_msgbuf[BOZO_LOG_MSGLEN];
+
+#endif /* BOZO_LOGH */
--- bozo/bosolog.c	2006-01-23 14:03:00.000000000 +0100
+++ bozo_new/bosolog.c	2006-01-23 11:53:55.000000000 +0100
@@ -0,0 +1,118 @@
+#include "bosolog.h"
+
+int LoggingMode = BOZO_DO_FILE_LOGGING;
+
+FILE *bozo_logFile;
+
+#ifndef AFS_NT40_ENV
+int LogFacility = LOG_DAEMON;
+#else
+int LogFacility = 0;
+#endif
+
+void
+bozo_Log(char *msg)
+{
+    char tdate[26];
+    time_t myTime;
+
+    switch (LoggingMode) {
+	case BOZO_DO_SYS_LOGGING  : {
+	    #ifndef AFS_NT40_ENV
+	    syslog(LOG_INFO, msg);
+	    #endif
+            ;
+	}
+	case BOZO_DO_FILE_LOGGING : {
+	    myTime = time(0);
+	    strcpy(tdate, (char *) ctime(&myTime));	/* copy out of static area asap */
+	    tdate[24] = ':';
+
+	    /* log normally closed, so can be removed */
+
+	    bozo_logFile = fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
+	    if (bozo_logFile == NULL) {
+	        fprintf(stderr,"bosserver: WARNING: problem with %s",
+		       AFSDIR_SERVER_BOZLOG_FILEPATH);
+		bozo_logFile=stderr;
+	    }
+
+	    fprintf(bozo_logFile, "%s ", tdate);
+	    fprintf(bozo_logFile, msg);
+	    if (bozo_logFile != stderr) {
+		fflush(bozo_logFile);
+		
+	    }
+        }
+    }
+}
+
+int getLoggingMode() {
+	return LoggingMode;
+}
+
+int setLoggingMode(int Mode) {
+	if ( Mode < 0 || Mode > BOZO_MAX_LOGGING_MODE ) {
+	    return -1;
+	}
+	else {
+            LoggingMode = Mode;
+	    return 0;
+	}
+}
+
+int getLogFacility() {
+	return LogFacility;
+}
+
+int setLogFacility(int Facility) {
+	if (Facility == LOG_DAEMON)
+ 		return 0;
+	else
+		return -1;
+}
+    
+int initializeLogging() {
+    char namebuf[AFSDIR_PATH_MAX];
+    char tdate[100];
+    struct tm* myTime;
+    time_t tm;
+
+    tm=time(NULL);
+    myTime = localtime(&tm);
+    strftime(tdate,100,"-%Y-%m-%d-%H:%M",myTime);
+
+    switch (LoggingMode) {
+	case BOZO_DO_FILE_LOGGING : {
+	    strncpy(namebuf, AFSDIR_BOZLOG_FILE,AFSDIR_PATH_MAX);
+	    strncat(namebuf, tdate,AFSDIR_PATH_MAX);
+	    renamefile(AFSDIR_BOZLOG_FILE, namebuf);	/* try rename first */	
+	    bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
+	    if (bozo_logFile == NULL) {
+		fprintf(stderr,"bosserver: can't initialize log file (%s).\n",
+		AFSDIR_SERVER_BOZLOG_FILEPATH);
+	   	return 1;
+	    }
+	}
+	case BOZO_DO_SYS_LOGGING : {
+#ifndef AFS_NT40_ENV
+	    openlog("bosserver", LOG_PID, getLogFacility());
+#endif
+	    ; /* Error-handling ? */
+	}
+	default :
+	    ;
+        }
+    bozo_Log("Bosserver started.\n");
+    return 0;
+}
+
+void closeLogging() {
+	switch (LoggingMode) {
+	    case BOZO_DO_FILE_LOGGING :
+	        fclose(bozo_logFile);
+	    default :
+	        ;
+	}
+	return;
+}
--- bozo/bosoprocs.c	2003-12-07 23:49:18.000000000 +0100
+++ bozo_new/bosoprocs.c	2006-01-23 14:12:49.000000000 +0100
@@ -48,13 +48,13 @@
 
 #include "bnode.h"
 #include "bosint.h"
+#include "bosolog.h"
 
 
 extern struct ktime bozo_nextRestartKT, bozo_nextDayKT;
 
 extern struct afsconf_dir *bozo_confdir;
 extern int bozo_newKTs;
-extern int DoLogging;
 #ifdef BOS_RESTRICTED_MODE
 extern int bozo_isrestricted;
 #endif
@@ -99,8 +99,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing SetRestartTime\n", caller);
+    BOZO_LOG_2("%s is executing SetRestartTime\n", caller)
 
     code = 0;			/* assume success */
     switch (atype) {
@@ -147,8 +146,7 @@
 	goto fail;
     }
 #endif
-    if (DoLogging)
-	bozo_Log("%s is executing the shell command '%s'\n", caller, acmd);
+    BOZO_LOG_3("%s is executing the shell command '%s'\n", caller, acmd)
 
     /* should copy output to acall, but don't yet cause its hard */
     /*  hard... NOT!  Nnow _at least_ return the exit status */
@@ -225,8 +223,7 @@
 	return BZNOENT;
     }
 
-    if (DoLogging)
-	bozo_Log("%s is executing UnInstall '%s'\n", caller, filepath);
+    BOZO_LOG_3("%s is executing UnInstall '%s'\n", caller, filepath)
 
     strcpy(fpBak, filepath);
     strcat(fpBak, ".BAK");
@@ -328,8 +325,7 @@
     strcpy(filepath, fpp);
     free(fpp);
 
-    if (DoLogging)
-	bozo_Log("%s is executing Install '%s'\n", caller, filepath);
+    BOZO_LOG_3("%s is executing Install '%s'\n", caller, filepath)
 
     /* open file */
     fpp = filepath + strlen(filepath);
@@ -404,8 +400,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing SetCellName '%s'\n", caller, aname);
+    BOZO_LOG_3("%s is executing SetCellName '%s'\n", caller, aname)
 
     code =
 	afsconf_GetExtendedCellInfo(bozo_confdir, NULL, NULL, &tcell,
@@ -415,9 +410,9 @@
 
     /* Check that tcell has enough space for the new cellname. */
     if (strlen(aname) > sizeof tcell.name - 1) {
-	bozo_Log
+	BOZO_LOG_3
 	    ("ERROR: SetCellName: cell name '%s' exceeds %ld bytes (cell name not changed)\n",
-	     aname, (long)(sizeof tcell.name - 1));
+	     aname, (long)(sizeof tcell.name - 1))
 	code = BZDOM;
 	goto fail;
     }
@@ -509,8 +504,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing DeleteCellHost '%s'\n", caller, aname);
+    BOZO_LOG_3("%s is executing DeleteCellHost '%s'\n", caller, aname)
 
     code =
 	afsconf_GetExtendedCellInfo(bozo_confdir, NULL, NULL, &tcell,
@@ -560,8 +554,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing AddCellHost '%s'\n", caller, aname);
+    BOZO_LOG_3("%s is executing AddCellHost '%s'\n", caller, aname)
 
     code =
 	afsconf_GetExtendedCellInfo(bozo_confdir, NULL, NULL, &tcell,
@@ -595,19 +588,19 @@
 	 */
 	if (tcell.numServers >
 	    sizeof tcell.hostAddr / sizeof tcell.hostAddr[0]) {
-	    bozo_Log
+	    BOZO_LOG_3
 		("ERROR: AddCellHost: attempt to add more than %ld database servers (database server '%s' not added)\n",
 		 (long)(sizeof tcell.hostAddr / sizeof tcell.hostAddr[0]),
-		 aname);
+		 aname)
 	    code = BZDOM;
 	    goto fail;
 	}
 
 	/* Check that tcell has enough space for the new hostname. */
 	if (strlen(aname) > sizeof tcell.hostName[0] - 1) {
-	    bozo_Log
+	    BOZO_LOG_3
 		("ERROR: AddCellHost: host name '%s' exceeds %ld bytes (not added)\n",
-		 aname, (long)(sizeof tcell.hostName[0] - 1));
+		 aname, (long)(sizeof tcell.hostName[0] - 1))
 	    code = BZDOM;
 	    goto fail;
 	}
@@ -644,8 +637,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing ListKeys\n", caller);
+    BOZO_LOG_2("%s is executing ListKeys\n", caller)
 
     code = afsconf_GetKeys(bozo_confdir, &tkeys);
     if (code)
@@ -704,8 +696,7 @@
 	code = BZENCREQ;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing AddKey\n", caller);
+    BOZO_LOG_2("%s is executing AddKey\n", caller)
 
     code = afsconf_AddKey(bozo_confdir, an, akey, 0);
     if (code == AFSCONF_KEYINUSE)
@@ -727,8 +718,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing Set No Authentication\n", caller);
+    BOZO_LOG_2("%s is executing Set No Authentication\n", caller)
 
     afsconf_SetNoAuthFlag(bozo_confdir, aflag);
 
@@ -749,8 +739,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing DeleteKey\n", caller);
+    BOZO_LOG_2("%s is executing DeleteKey\n", caller);
 
     code = afsconf_DeleteKey(bozo_confdir, an);
 
@@ -790,8 +779,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing Add SuperUser '%s'\n", caller, aname);
+    BOZO_LOG_3("%s is executing Add SuperUser '%s'\n", caller, aname)
 
     code = afsconf_AddUser(bozo_confdir, aname);
 
@@ -813,8 +801,7 @@
 	goto fail;
     }
 
-    if (DoLogging)
-	bozo_Log("%s is executing Delete SuperUser '%s'\n", caller, aname);
+    BOZO_LOG_3("%s is executing Delete SuperUser '%s'\n", caller, aname)
 
     code = afsconf_DeleteUser(bozo_confdir, aname);
 
@@ -874,8 +861,7 @@
 	goto fail;
     }
 
-    if (DoLogging)
-	bozo_Log("%s is executing Wait for All\n", caller);
+    BOZO_LOG_2("%s is executing Wait for All\n", caller)
 
     code = bnode_WaitAll();
 
@@ -902,8 +888,7 @@
 	goto fail;
     }
 #endif
-    if (DoLogging)
-	bozo_Log("%s is executing DeleteBnode '%s'\n", caller, ainstance);
+    BOZO_LOG_3("%s is executing DeleteBnode '%s'\n", caller, ainstance)
 
     code = bnode_DeleteName(ainstance);
 
@@ -966,8 +951,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing ShutdownAll\n", caller);
+    BOZO_LOG_2("%s is executing ShutdownAll\n", caller)
 
     code = bnode_ApplyInstance(sdproc, NULL);
 
@@ -988,8 +972,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing RestartAll\n", caller);
+    BOZO_LOG_2("%s is executing RestartAll\n", caller)
 
     /* start shutdown of all processes */
     code = bnode_ApplyInstance(sdproc, NULL);
@@ -1021,8 +1004,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing ReBozo\n", caller);
+    BOZO_LOG_2("%s is executing ReBozo\n", caller)
 
     /* start shutdown of all processes */
     code = bnode_ApplyInstance(sdproc, NULL);
@@ -1065,8 +1047,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing StartupAll\n", caller);
+    BOZO_LOG_2("%s is executing StartupAll\n", caller)
     code = bnode_ApplyInstance(stproc, NULL);
 
   fail:
@@ -1087,8 +1068,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing Restart '%s'\n", caller, ainstance);
+    BOZO_LOG_3("%s is executing Restart '%s'\n", caller, ainstance)
 
     tb = bnode_FindInstance(ainstance);
     if (!tb) {
@@ -1125,8 +1105,7 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing SetTempStatus '%s'\n", caller, ainstance);
+    BOZO_LOG_3("%s is executing SetTempStatus '%s'\n", caller, ainstance)
 
     tb = bnode_FindInstance(ainstance);
     if (!tb) {
@@ -1157,9 +1136,8 @@
 	code = BZACCESS;
 	goto fail;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing SetStatus '%s' (status = %d)\n", caller,
-		 ainstance, astatus);
+    BOZO_LOG_4("%s is executing SetStatus '%s' (status = %d)\n", caller,
+		 ainstance, astatus)
 
     tb = bnode_FindInstance(ainstance);
     if (!tb) {
@@ -1265,8 +1243,7 @@
 	goto fail;
     }
 #endif
-    if (DoLogging)
-	bozo_Log("%s is executing Prune (flags=%d)\n", caller, aflags);
+    BOZO_LOG_3("%s is executing Prune (flags=%d)\n", caller, aflags)
 
     /* first scan AFS binary directory */
     dirp = opendir(AFSDIR_SERVER_BIN_DIRPATH);
@@ -1412,19 +1389,19 @@
     for (i = 0; i < bozo_nbosEntryStats; i++) {
 	struct bozo_bosEntryStats *e = &bozo_bosEntryStats[i];
 	if (!StatEachEntry(e)) {
-	    bozo_Log("unhappy with %s which is a %s that should "
+	    BOZO_LOG_6("unhappy with %s which is a %s that should "
 		     "have at least rights %o, at most rights %o %s\n",
 		     e->path, e->dir ? "dir" : "file", e->reqPerm, 
 		     (~e->proPerm & 0777), 
-		     e->rootOwner ? ", owned by root" : "");
+		     e->rootOwner ? ", owned by root" : "")
 	    result = 0;
 	    break;
 	}
     }
 
     if (result != lastResult) {	/* log changes */
-	bozo_Log("Server directory access is %sokay\n",
-		 (result ? "" : "not "));
+	BOZO_LOG_2("Server directory access is %sokay\n",
+		 (result ? "" : "not "))
     }
     lastResult = result;
     return lastResult;
@@ -1541,8 +1518,7 @@
     if (ConstructLocalLogPath(aname, &logpath)) {
 	return BZNOENT;
     }
-    if (DoLogging)
-	bozo_Log("%s is executing GetLog '%s'\n", caller, logpath);
+    BOZO_LOG_3("%s is executing GetLog '%s'\n", caller, logpath)
     tfile = fopen(logpath, "r");
     free(logpath);
 
@@ -1667,9 +1643,9 @@
 {
     int code;
 
-    bozo_Log
+    BOZO_LOG_2
 	("Shutdown of BOS server and processes in response to signal %d\n",
-	 asignal);
+	 asignal)
 
     /* start shutdown of all processes */
     if ((code = bnode_ApplyInstance(sdproc, NULL)) == 0) {
@@ -1678,8 +1654,8 @@
     }
 
     if (code) {
-	bozo_Log("Shutdown incomplete (code = %d); manual cleanup required\n",
-		 code);
+	BOZO_LOG_2("Shutdown incomplete (code = %d); manual cleanup required\n",
+		 code)
     }
 
     rx_Finalize();

--------------020402030505040206080406--