[Linux-ha-dev] [PATCH][STABLE_1_2_3] heartbeat/hb_api.c is too verbose

Alan Robertson alanr at unix.sh
Tue Dec 14 13:32:32 MST 2004


Roberto Nibali wrote:
> Hi,
> 
> We use a realtime ;) cluster status display for PS1. It's rather handy 
> and something we used in our HA software for a while. It roughly works 
> as follows:
> 
> CL_STATUS=/usr/opt/heartbeat/bin/cl_status
> PS1=`echo "\h-\`${CL_STATUS} nodestatus \\\`uname -n\\\` 2>/dev/null || 
> echo dead\`-\`${CL_STATUS} rscstatus 2>/dev/null || echo unknown\`:\`pwd 
> -P\` # ";`
> 
> Of course it calls cl_status twice for every newline in the shell and as 
> you probably know, this generates a couple of logfile entries every 
> time. These look similar to those:

OK.

How about the attached patch instead?


-- 
     Alan Robertson <alanr at unix.sh>

"Openness is the foundation and preservative of friendship...  Let me claim 
from you at all times your undisguised opinions." - William Wilberforce
-------------- next part --------------
Index: hb_api.c
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/hb_api.c,v
retrieving revision 1.122
diff -u -r1.122 hb_api.c
--- hb_api.c	4 Nov 2004 21:33:41 -0000	1.122
+++ hb_api.c	14 Dec 2004 20:31:44 -0000
@@ -1462,8 +1462,10 @@
 	}
 
 	if (CL_KILL(client->pid, client->signal) < 0 && errno == ESRCH) {
-		cl_log(LOG_INFO, "api_send_client: client %ld died"
-		,	(long) client->pid);
+		if (ANYDEBUG) {
+			cl_log(LOG_DEBUG, "api_send_client: client %ld died"
+			,	(long) client->pid);
+		}
 		if (!client->removereason) {
 			client->removereason = "died";
 		}
@@ -1854,9 +1856,11 @@
 
 		/* EOF? */
 		if (client->chan->ch_status == IPC_DISCONNECT) {
-			cl_log(LOG_INFO
-			,	"EOF from client pid %ld"
-			,	(long)client->pid);
+			if (ANYDEBUG) {
+				cl_log(LOG_DEBUG
+				,	"EOF from client pid %ld"
+				,	(long)client->pid);
+			}
 			client->removereason = "EOF";
 			goto getout;
 		}
@@ -1898,9 +1902,11 @@
 	/* May have gotten a message from 'client' */
 	if (CL_KILL(client->pid, 0) < 0 && errno == ESRCH) {
 		/* Oops... he's dead */
-		cl_log(LOG_INFO
-		,	"Client pid %ld died (input)"
-		,	(long)client->pid);
+		if (ANYDEBUG) {
+			cl_log(LOG_DEBUG
+			,	"Client pid %ld died (input)"
+			,	(long)client->pid);
+		}
 		client->removereason = "died";
 	}
 	if (DEBUGDETAILS) {


More information about the Linux-HA-Dev mailing list