Hi,

Le 27/12/2010 10:47, Gilles Darold a écrit :
> [...]
> Here is the rewritten patch that add syslog support to PgPool with all
> your great suggestions applied.
> This patch has been created from the current cvs HEAD branch.
> 

Thanks. There is a bug in it, that I fixed in the attached patch. Even
if you declare log_destination and syslog_ident as reloadable, it was
without effect because there was no code to handle opening or closing
syslog if they changed.

There is another thing that annoys me, but it isn't a bug. What is the
purpose of pool_config->logsyslog? is it just to avoid a strcmp? which
seems a poor optimization wrt having two variables with same meaning.

> This patch also modify the comment about logdir configuraion directive.
> 
> "Logging directory" has been change into "PgPool status file logging
> directory"
> 
> Feel free to apply or remove it. It just seems to me that 'logdir' =>
> "Logging directory" is very confusing and false as this directive is
> only used to save the pgpool_status file. It will certainly be better to
> rename this directive, but for the moment just changing the comment help
> a lot for understanding and preserve backward compatibility.
> 

I completely agree with you on that change. But I would much prefer to
see it applied as another patch rather than in this patch. They have two
different purposes, so they shouldn't be mixed.

BTW, Tatsuo-san, Gilles and I have absolutely no idea if we should
change pool_config.c, pool_config.l, or both. We did both, but I would
really like to know which of these three possibilities is the good one.
Thanks.

And thanks Gilles for this second patch. I should really start working
on my own :)


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com
Index: main.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/main.c,v
retrieving revision 1.87
diff -c -p -r1.87 main.c
*** main.c	12 Nov 2010 05:47:01 -0000	1.87
--- main.c	27 Dec 2010 14:55:58 -0000
*************** int main(int argc, char **argv)
*** 314,319 ****
--- 314,330 ----
  	}
  
  	/*
+ 	 * Open syslog connection if required
+ 	 */
+ 	if (!strcmp(pool_config->log_destination, "syslog")) {
+ 		openlog(pool_config->syslog_ident, LOG_PID|LOG_NDELAY|LOG_NOWAIT, pool_config->syslog_facility);
+ 		/* set a flag to allow pool_error.c to begin writing to syslog
+ 		   instead of stdout now that pool_get_config() is done */
+ 		pool_config->logsyslog = 1;
+ 	}
+ 
+ 
+ 	/*
  	 * Locate pool_passwd
  	 */
  	if (strcmp("", pool_config->pool_passwd))
Index: pgpool.conf.sample
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample,v
retrieving revision 1.40
diff -c -p -r1.40 pgpool.conf.sample
*** pgpool.conf.sample	30 Oct 2010 11:12:42 -0000	1.40
--- pgpool.conf.sample	27 Dec 2010 14:55:58 -0000
*************** client_idle_limit = 0
*** 53,61 ****
  # 0 means no timeout.
  authentication_timeout = 60
  
! # Logging directory
  logdir = '/tmp'
  
  # pid file name
  pid_file_name = '/var/run/pgpool/pgpool.pid'
  
--- 53,70 ----
  # 0 means no timeout.
  authentication_timeout = 60
  
! # PgPool status file logging directory
  logdir = '/tmp'
  
+ # Where to Log. Valid values are stderr and syslog. Default to stderr.
+ log_destination = 'stderr'
+ 
+ # Select syslog local facility for logging. Default: LOCAL0
+ syslog_facility = 'LOCAL0'
+ 
+ # Set the syslog program ident string. Default to 'pgpool'
+ syslog_ident = 'pgpool'
+ 
  # pid file name
  pid_file_name = '/var/run/pgpool/pgpool.pid'
  
Index: pgpool.conf.sample-master-slave
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample-master-slave,v
retrieving revision 1.13
diff -c -p -r1.13 pgpool.conf.sample-master-slave
*** pgpool.conf.sample-master-slave	30 Oct 2010 11:12:43 -0000	1.13
--- pgpool.conf.sample-master-slave	27 Dec 2010 14:55:58 -0000
*************** client_idle_limit = 0
*** 53,61 ****
  # 0 means no timeout.
  authentication_timeout = 60
  
! # Logging directory
  logdir = '/tmp'
  
  # pid file name
  pid_file_name = '/var/run/pgpool/pgpool.pid'
  
--- 53,70 ----
  # 0 means no timeout.
  authentication_timeout = 60
  
! # PgPool status file logging directory
  logdir = '/tmp'
  
+ # Where to Log. Valid values are stderr and syslog. Default to stderr.
+ log_destination = 'stderr'
+ 
+ # Select syslog local facility for logging. Default: LOCAL0
+ syslog_facility = 'LOCAL0'
+ 
+ # Set the syslog program ident string. Default to 'pgpool'
+ syslog_ident = 'pgpool'
+ 
  # pid file name
  pid_file_name = '/var/run/pgpool/pgpool.pid'
  
Index: pgpool.conf.sample-replication
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample-replication,v
retrieving revision 1.12
diff -c -p -r1.12 pgpool.conf.sample-replication
*** pgpool.conf.sample-replication	30 Oct 2010 11:12:43 -0000	1.12
--- pgpool.conf.sample-replication	27 Dec 2010 14:55:58 -0000
*************** client_idle_limit = 0
*** 53,61 ****
  # 0 means no timeout.
  authentication_timeout = 60
  
! # Logging directory
  logdir = '/tmp'
  
  # pid file name
  pid_file_name = '/var/run/pgpool/pgpool.pid'
  
--- 53,70 ----
  # 0 means no timeout.
  authentication_timeout = 60
  
! # PgPool status file logging directory
  logdir = '/tmp'
  
+ # Where to Log. Valid values are stderr and syslog. Default to stderr.
+ log_destination = 'stderr'
+ 
+ # Select syslog local facility for logging. Default: LOCAL0
+ syslog_facility = 'LOCAL0'
+ 
+ # Set the syslog program ident string. Default to 'pgpool'
+ syslog_ident = 'pgpool'
+ 
  # pid file name
  pid_file_name = '/var/run/pgpool/pgpool.pid'
  
Index: pgpool.conf.sample-stream
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample-stream,v
retrieving revision 1.6
diff -c -p -r1.6 pgpool.conf.sample-stream
*** pgpool.conf.sample-stream	30 Oct 2010 11:12:43 -0000	1.6
--- pgpool.conf.sample-stream	27 Dec 2010 14:55:58 -0000
*************** client_idle_limit = 0
*** 53,61 ****
  # 0 means no timeout.
  authentication_timeout = 60
  
! # Logging directory
  logdir = '/tmp'
  
  # pid file name
  pid_file_name = '/var/run/pgpool/pgpool.pid'
  
--- 53,70 ----
  # 0 means no timeout.
  authentication_timeout = 60
  
! # PgPool status file logging directory
  logdir = '/tmp'
  
+ # Where to Log. Valid values are stderr and syslog. Default to stderr.
+ log_destination = 'stderr'
+ 
+ # Select syslog local facility for logging. Default: LOCAL0
+ syslog_facility = 'LOCAL0'
+ 
+ # Set the syslog program ident string. Default to 'pgpool'
+ syslog_ident = 'pgpool'
+ 
  # pid file name
  pid_file_name = '/var/run/pgpool/pgpool.pid'
  
Index: pool.h
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool.h,v
retrieving revision 1.86
diff -c -p -r1.86 pool.h
*** pool.h	12 Nov 2010 08:09:32 -0000	1.86
--- pool.h	27 Dec 2010 14:55:58 -0000
***************
*** 43,48 ****
--- 43,50 ----
  #include <openssl/err.h>
  #endif
  
+ #include <syslog.h>
+ 
  /* undef this if you have problems with non blocking accept() */
  #define NONE_BLOCK
  
***************
*** 69,74 ****
--- 71,79 ----
  /* status file name */
  #define STATUS_FILE_NAME "pgpool_status"
  
+ /* default string used to identify pgpool on syslog output */
+ #define DEFAULT_SYSLOG_IDENT "pgpool"
+ 
  typedef enum {
  	POOL_CONTINUE = 0,
  	POOL_IDLE,
Index: pool_config.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_config.c,v
retrieving revision 1.53
diff -c -p -r1.53 pool_config.c
*** pool_config.c	26 Dec 2010 00:58:36 -0000	1.53
--- pool_config.c	27 Dec 2010 14:56:01 -0000
*************** int pool_init_config(void)
*** 1871,1876 ****
--- 1871,1880 ----
  	pool_config->child_max_connections = 0;
  	pool_config->authentication_timeout = 60;
  	pool_config->logdir = DEFAULT_LOGDIR;
+ 	pool_config->log_destination = "stderr";
+ 	pool_config->logsyslog = 0;
+ 	pool_config->syslog_facility = LOG_LOCAL0;
+ 	pool_config->syslog_ident = DEFAULT_SYSLOG_IDENT;
  	pool_config->pid_file_name = DEFAULT_PID_FILE_NAME;
   	pool_config->log_statement = 0;
   	pool_config->log_per_node_statement = 0;
*************** int pool_get_config(char *confpath, POOL
*** 2043,2048 ****
--- 2047,2053 ----
  	char key[1024];
  	double total_weight;
  	int i;
+     bool log_destination_changed = false;
  
  #define PARSE_ERROR()		pool_error("pool_config: parse error at line %d '%s'", Lineno, yytext)
  
*************** int pool_get_config(char *confpath, POOL
*** 2303,2308 ****
--- 2308,2370 ----
  			}
  			pool_config->logdir = str;
  		}
+ 		else if (!strcmp(key, "log_destination") &&
+ 			 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
+ 		{
+ 		    char *str;
+ 
+ 		    if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
+ 		    {
+ 			PARSE_ERROR();
+ 			fclose(fd);
+ 			return(-1);
+ 		    }
+ 		    str = extract_string(yytext, token);
+ 		    if (str == NULL)
+ 		    {
+ 			fclose(fd);
+ 			return(-1);
+ 		    }
+             log_destination_changed = pool_config->log_destination != str;
+ 		    pool_config->log_destination = str;
+ 		}
+ 		else if (!strcmp(key, "syslog_facility") && CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
+ 		{
+ 		    char *str;
+ 
+ 		    if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
+ 		    {
+ 			PARSE_ERROR();
+ 			fclose(fd);
+ 			return(-1);
+ 		    }
+ 		    str = extract_string(yytext, token);
+ 		    if (str == NULL)
+ 		    {
+ 			fclose(fd);
+ 			return(-1);
+ 		    }
+ 		    pool_config->syslog_facility = set_syslog_facility(str);
+ 		}
+ 		else if (!strcmp(key, "syslog_ident") && CHECK_CONTEXT(INIT_CONFIG, context))
+ 		{
+ 		    char *str;
+ 
+ 		    if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
+ 		    {
+ 			PARSE_ERROR();
+ 			fclose(fd);
+ 			return(-1);
+ 		    }
+ 		    str = extract_string(yytext, token);
+ 		    if (str == NULL)
+ 		    {
+ 			fclose(fd);
+ 			return(-1);
+ 		    }
+             log_destination_changed = log_destination_changed || pool_config->syslog_ident != str;
+ 		    pool_config->syslog_ident = str;
+ 		}
  		else if (!strcmp(key, "pid_file_name") && CHECK_CONTEXT(INIT_CONFIG, context))
  		{
  			char *str;
*************** int pool_get_config(char *confpath, POOL
*** 3332,3337 ****
--- 3394,3414 ----
  
  	fclose(fd);
  
+     if (log_destination_changed)
+     {
+         // log_destination has changed, we need to open syslog or close it
+ 		if (!strcmp(pool_config->log_destination, "stderr"))
+         {
+ 	        closelog();
+     	   	pool_config->logsyslog = 0;
+         }
+         else
+         {
+     	   	openlog(pool_config->syslog_ident, LOG_PID|LOG_NDELAY|LOG_NOWAIT, pool_config->syslog_facility);
+     	   	pool_config->logsyslog = 1;
+         }
+     }
+ 
  	pool_config->backend_desc->num_backends = 0;
  	total_weight = 0.0;
  
*************** static void print_host_entry(int slot)
*** 3634,3637 ****
--- 3711,3752 ----
  }
  #endif
  
+ /* Use to set the syslog facility level if logsyslog is activated */
+ int set_syslog_facility(char *value)
+ {
+    int facility = LOG_LOCAL0;
+ 
+    if (value == NULL)
+      return facility;
+ 
+    if (strncmp(value, "LOCAL", 5) == 0 && strlen(value) == 6) {
+ 	  switch (value[5]) {
+ 	  case '0':
+ 	       facility = LOG_LOCAL0;
+ 	       break;
+ 	  case '1':
+ 	       facility = LOG_LOCAL1;
+ 	       break;
+ 	  case '2':
+ 	       facility = LOG_LOCAL2;
+ 	       break;
+ 	  case '3':
+ 	       facility = LOG_LOCAL3;
+ 	       break;
+ 	  case '4':
+ 	       facility = LOG_LOCAL4;
+ 	       break;
+ 	  case '5':
+ 	       facility = LOG_LOCAL5;
+ 	       break;
+ 	  case '6':
+ 	       facility = LOG_LOCAL6;
+ 	       break;
+ 	  case '7':
+ 	       facility = LOG_LOCAL7;
+ 	       break;
+ 	  }
+      }
+      return facility;
+ }
  
Index: pool_config.h
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_config.h,v
retrieving revision 1.9
diff -c -p -r1.9 pool_config.h
*** pool_config.h	26 Dec 2010 00:58:36 -0000	1.9
--- pool_config.h	27 Dec 2010 14:56:01 -0000
*************** typedef struct {
*** 66,71 ****
--- 66,74 ----
  	int authentication_timeout; /* maximum time in seconds to complete client authentication */
      int	max_pool;	/* max # of connection pool per child */
      char *logdir;		/* logging directory */
+     char *log_destination;      /* log destination: stderr or syslog */
+     int syslog_facility;        /* syslog facility: LOCAL0, LOCAL1, ... */
+     char *syslog_ident;         /* syslog ident string: pgpool */
      char *pid_file_name;		/* pid file name */
      char *backend_socket_dir;	/* Unix domain socket directory for the PostgreSQL server */
  	int replication_mode;		/* replication mode */
*************** typedef struct {
*** 157,162 ****
--- 160,166 ----
  	int num_reset_queries;		/* number of queries in reset_query_list */
  	int num_white_function_list;		/* number of functions in white_function_list */
  	int num_black_function_list;		/* number of functions in black_function_list */
+ 	int logsyslog;		/* flag used to start logging to syslog */
  
  	/* ssl configuration */
  	int ssl;	/* if non 0, activate ssl support (frontend+backend) */
*************** extern int pool_init_config(void);
*** 182,187 ****
--- 186,194 ----
  extern int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context);
  extern int eval_logical(char *str);
  
+ /* method use for syslog support */
+ extern int set_syslog_facility (char *);
+ 
  /* methods used for regexp support */
  extern int add_regex_pattern(char *type, char *s);
  extern int growPatternArray (RegPattern item);
Index: pool_config.l
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_config.l,v
retrieving revision 1.49
diff -c -p -r1.49 pool_config.l
*** pool_config.l	26 Dec 2010 00:58:36 -0000	1.49
--- pool_config.l	27 Dec 2010 14:56:01 -0000
*************** int pool_init_config(void)
*** 146,151 ****
--- 146,155 ----
  	pool_config->child_max_connections = 0;
  	pool_config->authentication_timeout = 60;
  	pool_config->logdir = DEFAULT_LOGDIR;
+         pool_config->logsyslog = 0;
+         pool_config->log_destination = "stderr";
+         pool_config->syslog_facility = LOG_LOCAL0;
+         pool_config->syslog_ident = "pgpool";
  	pool_config->pid_file_name = DEFAULT_PID_FILE_NAME;
   	pool_config->log_statement = 0;
   	pool_config->log_per_node_statement = 0;
*************** int pool_get_config(char *confpath, POOL
*** 318,323 ****
--- 322,328 ----
  	char key[1024];
  	double total_weight;
  	int i;
+     bool log_destination_changed = false;
  
  #define PARSE_ERROR()		pool_error("pool_config: parse error at line %d '%s'", Lineno, yytext)
  
*************** int pool_get_config(char *confpath, POOL
*** 578,583 ****
--- 583,646 ----
  			}
  			pool_config->logdir = str;
  		}
+ 		else if (!strcmp(key, "log_destination") &&
+ 				 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
+ 		{
+ 			char *str;
+ 
+ 			if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
+ 			{
+ 				PARSE_ERROR();
+ 				fclose(fd);
+ 				return(-1);
+ 			}
+ 			str = extract_string(yytext, token);
+ 			if (str == NULL)
+ 			{
+ 				fclose(fd);
+ 				return(-1);
+ 			}
+             log_destination_changed = pool_config->log_destination != str;
+ 			pool_config->log_destination = str;
+ 		}
+ 		else if (!strcmp(key, "syslog_facility") && CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
+ 		{
+ 			char *str;
+ 
+ 			if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
+ 			{
+ 				PARSE_ERROR();
+ 				fclose(fd);
+ 				return(-1);
+ 			}
+ 			str = extract_string(yytext, token);
+ 			if (str == NULL)
+ 			{
+ 				fclose(fd);
+ 				return(-1);
+ 			}
+ 			pool_config->syslog_facility = set_syslog_facility(str);
+ 		}
+ 		else if (!strcmp(key, "syslog_ident") &&
+ 				 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
+ 		{
+ 			char *str;
+ 
+ 			if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
+ 			{
+ 				PARSE_ERROR();
+ 				fclose(fd);
+ 				return(-1);
+ 			}
+ 			str = extract_string(yytext, token);
+ 			if (str == NULL)
+ 			{
+ 				fclose(fd);
+ 				return(-1);
+ 			}
+             log_destination_changed = log_destination_changed || pool_config->syslog_ident != str;
+ 			pool_config->syslog_ident = str;
+ 		}
  		else if (!strcmp(key, "pid_file_name") && CHECK_CONTEXT(INIT_CONFIG, context))
  		{
  			char *str;
*************** int pool_get_config(char *confpath, POOL
*** 1615,1620 ****
--- 1678,1698 ----
  
  	fclose(fd);
  
+     if (log_destination_changed)
+     {
+         // log_destination has changed, we need to open syslog or close it
+ 		if (!strcmp(pool_config->log_destination, "stderr"))
+         {
+ 	        closelog();
+     	   	pool_config->logsyslog = 0;
+         }
+         else
+         {
+     	   	openlog(pool_config->syslog_ident, LOG_PID|LOG_NDELAY|LOG_NOWAIT, pool_config->syslog_facility);
+     	   	pool_config->logsyslog = 1;
+         }
+     }
+ 
  	pool_config->backend_desc->num_backends = 0;
  	total_weight = 0.0;
  
*************** static void print_host_entry(int slot)
*** 1917,1919 ****
--- 1995,2036 ----
  }
  #endif
  
+ /* Use to set the syslog facility level if logsyslog is activated */
+ int set_syslog_facility(char *value)
+ {
+    int facility = LOG_LOCAL0;
+ 
+    if (value == NULL)
+      return facility;
+ 
+    if (strncmp(value, "LOCAL", 5) == 0 && strlen(value) == 6) {
+ 	  switch (value[5]) {
+ 	  case '0':
+ 	       facility = LOG_LOCAL0;
+ 	       break;
+ 	  case '1':
+ 	       facility = LOG_LOCAL1;
+ 	       break;
+ 	  case '2':
+ 	       facility = LOG_LOCAL2;
+ 	       break;
+ 	  case '3':
+ 	       facility = LOG_LOCAL3;
+ 	       break;
+ 	  case '4':
+ 	       facility = LOG_LOCAL4;
+ 	       break;
+ 	  case '5':
+ 	       facility = LOG_LOCAL5;
+ 	       break;
+ 	  case '6':
+ 	       facility = LOG_LOCAL6;
+ 	       break;
+ 	  case '7':
+ 	       facility = LOG_LOCAL7;
+ 	       break;
+ 	  }
+      }
+      return facility;
+ }
+ 
Index: pool_error.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_error.c,v
retrieving revision 1.8
diff -c -p -r1.8 pool_error.c
*** pool_error.c	10 Aug 2010 15:08:32 -0000	1.8
--- pool_error.c	27 Dec 2010 14:56:02 -0000
*************** void pool_error(const char *fmt,...)
*** 50,55 ****
--- 50,62 ----
  #else
  	int	oldmask;
  #endif
+ 	/* Write error message to syslog */
+ 	if (pool_config->logsyslog == 1) {
+ 	   va_start(ap, fmt);
+ 	   vsyslog(pool_config->syslog_facility | LOG_ERR, fmt, ap);
+ 	   va_end(ap);
+ 	   return;
+ 	}
  
  	POOL_SETMASK2(&BlockSig, &oldmask);
  
*************** void pool_debug(const char *fmt,...)
*** 105,110 ****
--- 112,124 ----
  		if (pool_config->debug_level <= 0)
  			return;
  	}
+ 	/* Write debug message to syslog */
+ 	if (pool_config->logsyslog == 1) {
+ 	   va_start(ap, fmt);
+ 	   vsyslog(pool_config->syslog_facility | LOG_DEBUG, fmt, ap);
+ 	   va_end(ap);
+ 	   return;
+ 	}
  
  	POOL_SETMASK2(&BlockSig, &oldmask);
  
*************** void pool_log(const char *fmt,...)
*** 149,154 ****
--- 163,175 ----
  #else
  	int	oldmask;
  #endif
+ 	/* Write log message to syslog */
+ 	if (pool_config->logsyslog == 1) {
+ 	   va_start(ap, fmt);
+ 	   vsyslog(pool_config->syslog_facility | LOG_NOTICE, fmt, ap);
+ 	   va_end(ap);
+ 	   return;
+ 	}
  
  	POOL_SETMASK2(&BlockSig, &oldmask);
  
Index: pool_process_reporting.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_process_reporting.c,v
retrieving revision 1.16
diff -c -p -r1.16 pool_process_reporting.c
*** pool_process_reporting.c	28 Nov 2010 14:57:17 -0000	1.16
--- pool_process_reporting.c	27 Dec 2010 14:56:02 -0000
*************** void config_reporting(POOL_CONNECTION *f
*** 173,179 ****
  
  	strncpy(status[i].name, "logdir", POOLCONFIG_MAXNAMELEN);
  	snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->logdir);
! 	strncpy(status[i].desc, "logging directory", POOLCONFIG_MAXDESCLEN);
  	i++;
  
  	strncpy(status[i].name, "pid_file_name", POOLCONFIG_MAXNAMELEN);
--- 173,194 ----
  
  	strncpy(status[i].name, "logdir", POOLCONFIG_MAXNAMELEN);
  	snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->logdir);
! 	strncpy(status[i].desc, "PgPool status file logging directory", POOLCONFIG_MAXDESCLEN);
! 	i++;
! 
! 	strncpy(status[i].name, "log_destination", POOLCONFIG_MAXNAMELEN);
! 	snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->log_destination);
! 	strncpy(status[i].desc, "logging destination", POOLCONFIG_MAXDESCLEN);
! 	i++;
! 
! 	strncpy(status[i].name, "syslog_facility", POOLCONFIG_MAXNAMELEN);
! 	snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "LOCAL%d", (pool_config->syslog_facility/8) - 16);
! 	strncpy(status[i].desc, "syslog local faclity", POOLCONFIG_MAXDESCLEN);
! 	i++;
! 
! 	strncpy(status[i].name, "syslog_ident", POOLCONFIG_MAXNAMELEN);
! 	snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->syslog_ident);
! 	strncpy(status[i].desc, "syslog program ident string", POOLCONFIG_MAXDESCLEN);
  	i++;
  
  	strncpy(status[i].name, "pid_file_name", POOLCONFIG_MAXNAMELEN);
Index: pool_shmem.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_shmem.c,v
retrieving revision 1.5
diff -c -p -r1.5 pool_shmem.c
*** pool_shmem.c	22 Aug 2009 04:04:21 -0000	1.5
--- pool_shmem.c	27 Dec 2010 14:56:02 -0000
*************** void
*** 127,132 ****
--- 127,134 ----
  pool_shmem_exit(int code)
  {
  	shmem_exit(code);
+ 	/* Close syslog connection here as this function is always called on exit */
+ 	closelog();
  }
  
  /*
_______________________________________________
Pgpool-hackers mailing list
[email protected]
http://pgfoundry.org/mailman/listinfo/pgpool-hackers

Reply via email to