[OpenAFS-devel] fixes for logging
Nathan Neulinger
nneul@umr.edu
Tue, 3 Apr 2001 09:48:29 -0500
--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
change ubik to use ubik_print wherever it can. Not ideal for syslogs, as
it goes to multiple lines, but better than sending to stdout.
in serverLog, only flush when needed, not when using syslogs, also flush
the serverLogFD, since you might not have redirected stdout/stderr.
-- Nathan
------------------------------------------------------------
Nathan Neulinger EMail: nneul@umr.edu
University of Missouri - Rolla Phone: (573) 341-4841
Computing Services Fax: (573) 341-4216
--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="log.noprintf.diff"
Index: util/serverLog.c
===================================================================
RCS file: /cvs/openafs/src/util/serverLog.c,v
retrieving revision 1.6
diff -u -u -r1.6 serverLog.c
--- util/serverLog.c 2001/03/26 19:26:17 1.6
+++ util/serverLog.c 2001/04/03 14:46:40
@@ -116,8 +116,12 @@
UNLOCK_SERVERLOG();
#if !defined(AFS_PTHREAD_ENV)
- fflush(stdout);
- fflush(stderr); /* in case they're sharing the same FD */
+ if ( ! serverLogSyslog ) {
+ if ( serverLogFD > 0 )
+ fflush(serverLogFD); /* in case not on stdout/stderr */
+ fflush(stdout);
+ fflush(stderr); /* in case they're sharing the same FD */
+ }
#endif
}
Index: ubik/beacon.c
===================================================================
RCS file: /cvs/openafs/src/ubik/beacon.c,v
retrieving revision 1.4
diff -u -u -r1.4 beacon.c
--- ubik/beacon.c 2001/03/28 06:51:25 1.4
+++ ubik/beacon.c 2001/04/03 14:46:40
@@ -615,9 +615,8 @@
code = UBADHOST; /* remote CellServDB inconsistency */
ubik_print("Inconsistent Cell Info on server: ");
for ( j=0; j < UBIK_MAX_INTERFACE_ADDR && ts->addr[j]; j++)
- printf("%s ", afs_inet_ntoa(ts->addr[j]));
- printf("\n");
- fflush(stdout); fflush(stderr);
+ ubik_print("%s ", afs_inet_ntoa(ts->addr[j]));
+ ubik_print("\n");
}
else {
ts->up= 0; /* mark the remote server as down */
Index: ubik/lock.c
===================================================================
RCS file: /cvs/openafs/src/ubik/lock.c,v
retrieving revision 1.2
diff -u -u -r1.2 lock.c
--- ubik/lock.c 2000/11/04 10:05:52 1.2
+++ ubik/lock.c 2001/04/03 14:46:40
@@ -74,7 +74,7 @@
return UDONE;
if (atrans->locktype != 0) {
- printf("Ubik: Internal Error: attempted to take lock twice\n");
+ ubik_print("Ubik: Internal Error: attempted to take lock twice\n");
abort();
}
Index: ubik/remote.c
===================================================================
RCS file: /cvs/openafs/src/ubik/remote.c,v
retrieving revision 1.2
diff -u -u -r1.2 remote.c
--- ubik/remote.c 2000/11/04 10:05:53 1.2
+++ ubik/remote.c 2001/04/03 14:46:40
@@ -592,8 +592,8 @@
{
ubik_print("Inconsistent Cell Info from server: ");
for ( i=0; i < UBIK_MAX_INTERFACE_ADDR && inAddr->hostAddr[i]; i++)
- printf("%s ", afs_inet_ntoa(htonl(inAddr->hostAddr[i])));
- printf("\n");
+ ubik_print("%s ", afs_inet_ntoa(htonl(inAddr->hostAddr[i])));
+ ubik_print("\n");
printServerInfo();
return UBADHOST;
}
@@ -604,9 +604,8 @@
ubik_print("ubik: A Remote Server has addresses: ");
for ( i=0; i < UBIK_MAX_INTERFACE_ADDR && ts->addr[i]; i++)
- printf("%s ", afs_inet_ntoa(ts->addr[i]));
- printf("\n");
- fflush(stdout); fflush(stderr);
+ ubik_print("%s ", afs_inet_ntoa(ts->addr[i]));
+ ubik_print("\n");
return 0;
}
@@ -619,12 +618,11 @@
ubik_print("Local CellServDB:");
for ( ts=ubik_servers; ts; ts= ts->next, j++)
{
- printf("Server %d: ", j);
+ ubik_print("Server %d: ", j);
for ( i=0; (i<UBIK_MAX_INTERFACE_ADDR) && ts->addr[i]; i++)
- printf("%s ", afs_inet_ntoa(ts->addr[i]));
+ ubik_print("%s ", afs_inet_ntoa(ts->addr[i]));
}
- printf("\n");
- fflush(stdout); fflush(stderr);
+ ubik_print("\n");
}
SDISK_SetVersion(rxcall, atid, oldversionp, newversionp)
Index: ubik/ubik.c
===================================================================
RCS file: /cvs/openafs/src/ubik/ubik.c,v
retrieving revision 1.3
diff -u -u -r1.3 ubik.c
--- ubik/ubik.c 2001/02/12 21:57:58 1.3
+++ ubik/ubik.c 2001/04/03 14:46:41
@@ -500,7 +500,7 @@
to us, or timeout. Put safety check in anyway */
if (now - realStart > 10 * BIGTIME) {
ubik_stats.escapes++;
- printf("ubik escaping from commit wait\n");
+ ubik_print("ubik escaping from commit wait\n");
break;
}
for(ts = ubik_servers; ts; ts=ts->next) {
@@ -824,9 +824,9 @@
char *a, *b, *c, *d;
{
ubik_print("Ubik PANIC: ");
- printf(a, b, c, d);
+ ubik_print(a, b, c, d);
abort();
- printf("BACK FROM ABORT\n"); /* shouldn't come back */
+ ubik_print("BACK FROM ABORT\n"); /* shouldn't come back */
exit(1); /* never know, though */
}
--4Ckj6UjgE2iN1+kY--