[packages/pgpool-II] log to syslog

jajcus jajcus at pld-linux.org
Wed Nov 30 13:07:51 CET 2016


commit eb61ed23e7d323047bfc2aa1fab56e9d695428d7
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Wed Nov 30 12:19:09 2016 +0100

    log to syslog
    
    stderr logging is unreliable and log rotation cannot be done properly
    syslog logging also works well with systemd (logs go to the journal)

 config.patch     | 12 ++++++++++++
 pgpool-II.spec   |  5 ++---
 pgpool.init      |  9 ++-------
 pgpool.sysconfig |  2 --
 4 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/pgpool-II.spec b/pgpool-II.spec
index 253b162..ca81a8f 100644
--- a/pgpool-II.spec
+++ b/pgpool-II.spec
@@ -1,7 +1,4 @@
 #
-# TODO
-# - logrotate script (note not needed under systemd: logs go to journal)
-#
 %bcond_without	openssl	# build without SSL support
 %bcond_without	pam	# don't build with pam support
 #
@@ -21,6 +18,7 @@ Source2:	%{relname}.monitrc
 Source3:	%{relname}.sysconfig
 Source4:	%{relname}.tmpfiles
 Source5:	%{relname}.service
+Patch0:		config.patch
 URL:		http://www.pgpool.net/
 %{?with_openssl:BuildRequires:	openssl-devel}
 %{?with_pam:BuildRequires:	pam-devel}
@@ -110,6 +108,7 @@ Plik monitrc do monitorowania pgpool.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %{__libtoolize}
diff --git a/config.patch b/config.patch
new file mode 100644
index 0000000..5278e1a
--- /dev/null
+++ b/config.patch
@@ -0,0 +1,12 @@
+diff -dur pgpool-II-3.6.0.orig/src/sample/pgpool.conf.sample pgpool-II-3.6.0/src/sample/pgpool.conf.sample
+--- pgpool-II-3.6.0.orig/src/sample/pgpool.conf.sample	2016-11-21 09:30:15.000000000 +0100
++++ pgpool-II-3.6.0/src/sample/pgpool.conf.sample	2016-11-30 12:17:42.000000000 +0100
+@@ -145,7 +145,7 @@
+ 
+ # - Where to log -
+ 
+-log_destination = 'stderr'
++log_destination = 'syslog'
+                                    # Where to log
+                                    # Valid values are combinations of stderr,
+                                    # and syslog. Default to stderr.
diff --git a/pgpool.init b/pgpool.init
index 1b94d16..031cf6d 100644
--- a/pgpool.init
+++ b/pgpool.init
@@ -19,7 +19,6 @@ PGPOOLUID=pgpool
 PGPOOLGID=pgpool
 PGPOOLCONF=/etc/pgpool.conf
 PGPOOLHBA=/etc/pool_hba.conf
-PGPOOLLOG=/var/log/pgpool.log
 SHUTDOWN_MODE=smart
 
 # Get service config
@@ -35,10 +34,6 @@ else
 	exit 0
 fi
 
-if [ ! -f $PGPOOLLOG ]; then
-	touch $PGPOOLLOG
-fi
-
 
 start() {
 	# Check if the service is already running?
@@ -46,7 +41,7 @@ start() {
 		msg_starting pgpool
 		busy
 		start-stop-daemon -S -x $PGPOOL_BIN -c $PGPOOLUID:$PGPOOLGID -p /var/run/pgpool/pgpool.pid \
-			-- -f $PGPOOLCONF -a $PGPOOLHBA $OPTS >> $PGPOOLLOG 2>&1
+			-- -f $PGPOOLCONF -a $PGPOOLHBA $OPTS
 		RETVAL=$?
 		if [ $RETVAL -eq 0 ]; then
 			touch /var/lock/subsys/pgpool
@@ -85,7 +80,7 @@ reload() {
 	if [ -f /var/lock/subsys/pgpool ]; then
 		msg_reloading pgpool
 		busy
-		$PGPOOL_BIN -f $PGPOOLCONF reload >> $PGPOOLLOG 2>&1
+		$PGPOOL_BIN -f $PGPOOLCONF reload
 		if [ $? -eq 0 ]; then
 			ok
 		else
diff --git a/pgpool.sysconfig b/pgpool.sysconfig
index be92298..3861883 100644
--- a/pgpool.sysconfig
+++ b/pgpool.sysconfig
@@ -8,8 +8,6 @@ PGPOOLGID=pgpool
 PGPOOLCONF=/etc/pgpool.conf
 PGPOOLHBA=/etc/pool_hba.conf
 
-PGPOOLLOG=/var/log/pgpool.log
-
 SHUTDOWN_MODE=smart
 
 # Options for pgpool
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/pgpool-II.git/commitdiff/eb61ed23e7d323047bfc2aa1fab56e9d695428d7



More information about the pld-cvs-commit mailing list