Thread: postgres log file

postgres log file

From
"surabhi.ahuja"
Date:
 hi
I start postmaster by giving the following command
 
/usr/bin/pg_ctl -w -l postgreslog -D $PGDATA -p /usr/bin/postmaster -o '-p ${PGPORT}' start
 
however nothing gets looged in postgrelog.
 
if i see postgreslog it shows me only this:
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shutting down
LOG:  logger shuttin ...
 
 
... and so on.
 
how do i log what all commands the server is receving from client etc....
 
 
thanks,
reagrds
Surabhi Ahuja

Re: postgres log file

From
Richard Huxton
Date:
surabhi.ahuja wrote:
>  hi
> I start postmaster by giving the following command
>
> /usr/bin/pg_ctl -w -l postgreslog -D $PGDATA -p /usr/bin/postmaster -o '-p ${PGPORT}' start
>
> however nothing gets looged in postgrelog.
>
> if i see postgreslog it shows me only this:
> LOG:  logger shutting down
> LOG:  logger shutting down

Does the PostgreSQL server process have permission to write to the file
"postgrelog" in whatever directory this is?

Normally you'd create a directory owned by user postgres (e.g.
/var/log/postgresql) and then log to a file in that directory.

--
   Richard Huxton
   Archonet Ltd

Re: postgres log file

From
"surabhi.ahuja"
Date:
 the postgreslog has permission - 777, so anyone is able to write in it.
that s why it is atleast showing
 
> LOG:  logger shutting down
but i want more logging to be done ..how can it be done ..
 
thanks,
regards
Surabhi
 


From: Richard Huxton [mailto:dev@archonet.com]
Sent: Tue 11/29/2005 5:40 PM
To: surabhi.ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] postgres log file

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********


surabhi.ahuja wrote:
>  hi
> I start postmaster by giving the following command

> /usr/bin/pg_ctl -w -l postgreslog -D $PGDATA -p /usr/bin/postmaster -o '-p ${PGPORT}' start

> however nothing gets looged in postgrelog.

> if i see postgreslog it shows me only this:
> LOG:  logger shutting down
> LOG:  logger shutting down

Does the PostgreSQL server process have permission to write to the file
"postgrelog" in whatever directory this is?

Normally you'd create a directory owned by user postgres (e.g.
/var/log/postgresql) and then log to a file in that directory.

--
   Richard Huxton
   Archonet Ltd


Re: postgres log file

From
Richard Huxton
Date:
surabhi.ahuja wrote:
>  the postgreslog has permission - 777, so anyone is able to write in it.
> that s why it is atleast showing
>
>> LOG:  logger shutting down
>
> but i want more logging to be done ..how can it be done ..

Oh - I thought the message was being echoed to STDERR. You'll still want
to setup a directory to store the log-files in, otherwise they can't be
rotated. Create /var/log/postgresql and make sure it's owned by the
"postgres" user (or whoever the db runs as) and is only writable by that
user.

Anyway, as far as I can see, this message is only produced when there is
no database process for the logger to read from (see file
backend/postmaster/syslogger.c about line 360).

This implies the system itself is shutting down. Are you still having
problems with your custom startup script?

Two things I'd consider:
1. Install from a package (8.1 should be available for most platforms now).
2. Use the syslog daemon to record your logs.

--
   Richard Huxton
   Archonet Ltd

Re: postgres log file

From
"surabhi.ahuja"
Date:
how do i  "Use the syslog daemon to record your logs."
 
thanks,
regards
Surabhi


From: Richard Huxton [mailto:dev@archonet.com]
Sent: Thu 12/1/2005 3:07 PM
To: surabhi.ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] postgres log file

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********


surabhi.ahuja wrote:
>  the postgreslog has permission - 777, so anyone is able to write in it.
> that s why it is atleast showing

>> LOG:  logger shutting down
>
> but i want more logging to be done ..how can it be done ..

Oh - I thought the message was being echoed to STDERR. You'll still want
to setup a directory to store the log-files in, otherwise they can't be
rotated. Create /var/log/postgresql and make sure it's owned by the
"postgres" user (or whoever the db runs as) and is only writable by that
user.

Anyway, as far as I can see, this message is only produced when there is
no database process for the logger to read from (see file
backend/postmaster/syslogger.c about line 360).

This implies the system itself is shutting down. Are you still having
problems with your custom startup script?

Two things I'd consider:
1. Install from a package (8.1 should be available for most platforms now).
2. Use the syslog daemon to record your logs.

--
   Richard Huxton
   Archonet Ltd


Re: postgres log file

From
Richard Huxton
Date:
surabhi.ahuja wrote:
> how do i  "Use the syslog daemon to record your logs."

See Ch 17.7 of the manuals "Error reporting and logging". You'll want to
set your log_destination to syslog and make sure syslog itself is set up
to route LOCAL0 (or whatever facility you use if you change it).

But - don't just do this because you're having problems with logging to
files. Figure out *why* you are having the problems first and then
decide if you want to switch.

--
   Richard Huxton
   Archonet Ltd