Bug 60890

Summary: log information redirected to /dev/null in the init.d stcript
Product: [Retired] Red Hat Linux Reporter: Tomas Winkler <tomasw>
Component: postgresqlAssignee: Fernando Nasser <fnasser>
Status: CLOSED RAWHIDE QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 7.2CC: jean-pierre.matsumoto, jpdalbec, sergio_kessler
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-02-10 18:39:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Winkler 2002-03-08 14:13:00 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5) Gecko/20011012

Description of problem:
the log infromation of the server is redirected to /dev/null so for example here
is no way to find out why the server doesn't start. 

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.for example a computer crashed
2./sbin/service postgresql start 
3.
	

Actual Results:  /var/log/pgsql is empty 

Expected Results:  cat /var/log/pgsql 
Found a pre-existing shared memory block (ID 491520) still in use.
If you're sure there are no old backends still running,
remove the shared memory block with ipcrm(1), or just
delete "/var/lib/pgsql/data/postmaster.pid".


Additional info:

There should  be used -l otion of pg_ctl for loging e.g.
/etc/rc.d/init.d/postgresql:135:            su -l postgres -s /bin/sh -c
"/usr/bin/pg_ctl  -l /var/log/pgsql -D $PGDATA -p /usr/bin/postmaster start  >
/dev/null 2>&1" < /dev/null

Comment 1 Trond Eivind Glomsrxd 2002-04-03 17:24:34 UTC
Not a bug as such... it's redirected to /dev/null in order to avoid spewing many
lines of output when successful. I'll think about how to not throw it away if
failing...

Comment 2 Need Real Name 2002-06-24 13:17:14 UTC
I agree with tomas, the init script is throwing away *information*, it is up to 
me if the "many lines of output when successful" are useful for me or not.

ideally the log information should be in /var/log/pgsql/pgsql.log and be 
rotated (like all others daemons)

/sergio

Comment 3 John Dalbec 2002-07-29 12:47:05 UTC
I don't think four lines of output on startup and three on shutdown constitute "spewing many lines of output".  This would really be extremely helpful in debugging 
intermittent startup problems.  I think assigning this a "low" severity is inappropriate.  Perhaps I should file a bug report saying "Postgresql sometimes fails to start at 
boot time.  I don't have any details because your init script throws away all the output."

Comment 4 John Dalbec 2002-07-29 14:57:51 UTC
I wrote:
> I don't think four lines of output on startup and three on shutdown constitute "spewing many lines of output".
I guess I missed the part about 16 lines of output for every database query. :-(
Still, I think the log information is valuable.  I've changed my initscripts and created a logrotate script to keep the output from filling /var.

--- postgresql  Mon Jul 29 10:49:44 2002
+++ /etc/init.d/postgresql      Mon Jul 29 09:29:07 2002
@@ -125,7 +125,7 @@
                #all systems go -- remove any stale lock files
                rm -f /tmp/.s.PGSQL.* > /dev/null
                echo -n $"Starting postgresql service: "
-               su -l postgres -c "/usr/bin/pg_ctl  -D $PGDATA -p /usr/bin/postmaster start >/dev/null 2>&1" < /dev/null
+               su -l postgres -c "/bin/touch /var/log/pgsql/pgsql.log; /usr/bin/pg_ctl  -D $PGDATA -p /usr/bin/postmaster start >>/var/log/pgsql/pgsql.log 2>&1" < /dev/null
                sleep 2
                pid=`pidof postmaster`
                if [ $pid ]

/etc/logrotate.d/postgresql:
/var/log/pgsql/pgsql.log {
        weekly
        notifempty
        missingok
        postrotate
                /sbin/service postgresql condrestart
        endscript
}

drwx------    2 postgres postgres     4096 Jul 29 09:05 /var/log/pgsql/


Comment 5 Andrew Overholt 2003-03-12 22:00:28 UTC
This is currently being worked on and will be fixed in an upcoming release.

Comment 6 jean-pierre.matsumoto 2003-05-18 13:12:12 UTC
Still in version 9.

Comment 7 jean-pierre.matsumoto 2003-05-18 14:00:33 UTC
file (not dir ! ) /var/log/pgsql is touched by RPM postgresql-server but is
never used.


Comment 8 Sergio A. Kessler 2004-06-16 14:45:47 UTC
still in FC2, 
yeah, TWO years !  happy birthdate bug !

Comment 9 Fernando Nasser 2004-06-18 14:08:40 UTC
Yes, that is the time we've been asking the PostgreSQL community to
provide a way of doing log rotation.  Without it the log can crash
your system by filling the disk.

Please post a note to pgsql-hackers asking for a log
rotation mechanism.  We have a init script that stores the log in
/var/log ready, just waiting for that to become available.

Comment 10 Tom Lane 2005-02-10 18:39:58 UTC
This is (at long last) done in PostgreSQL 8.0.