Bug 60890 - log information redirected to /dev/null in the init.d stcript
log information redirected to /dev/null in the init.d stcript
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: postgresql (Show other bugs)
7.2
All Linux
medium Severity low
: ---
: ---
Assigned To: Fernando Nasser
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-03-08 09:13 EST by Tomas Winkler
Modified: 2007-04-18 12:40 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-02-10 13:39:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tomas Winkler 2002-03-08 09:13:00 EST
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 12:24:34 EST
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 09:17:14 EDT
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 08:47:05 EDT
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 10:57:51 EDT
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 17:00:28 EST
This is currently being worked on and will be fixed in an upcoming release.
Comment 6 jean-pierre.matsumoto 2003-05-18 09:12:12 EDT
Still in version 9.
Comment 7 jean-pierre.matsumoto 2003-05-18 10:00:33 EDT
file (not dir ! ) /var/log/pgsql is touched by RPM postgresql-server but is
never used.
Comment 8 Sergio A. Kessler 2004-06-16 10:45:47 EDT
still in FC2, 
yeah, TWO years !  happy birthdate bug !
Comment 9 Fernando Nasser 2004-06-18 10:08:40 EDT
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@postgresql.org 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 13:39:58 EST
This is (at long last) done in PostgreSQL 8.0.

Note You need to log in before you can comment on or make changes to this bug.