Skip site navigation (1) Skip section navigation (2)

Re: log file?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dan B <db(at)cyclonehq(dot)dnsalias(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org, danb(at)cyclonecomputers(dot)com
Subject: Re: log file?
Date: 2001-01-16 16:19:22
Message-ID: 12680.979661962@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Dan B <db(at)cyclonehq(dot)dnsalias(dot)net> writes:
> I'm sorry about asking this here, since I'm sure it is a FAQ.
> I'm using an ecommerce app (interchange) and it's giving me some database 
> errors (unterminated quoted string, blah blah).  I would like to see the 
> SQL code as it is being executed (or given) to postgresql.  Since my app 
> doesn't have a log that tells exactly what it is saying to postgresql, I 
> assume postgresql has this kind of logging capability.  (I was thinking of 
> a file that I could just 'tail -f'.)  It would really help me debug my app.

(1) Make sure the postmaster is being started without -S switch, and
redirect its stdout and stderr into a log file of your choice.  For
example,
	postmaster -i -D /whatever >/path/to/logfile 2>&1 &

(2) To cause queries to be logged, you also need -d2 or higher.  You
can add that to the postmaster's startup command, but your log file
will probably grow rapidly if you turn it on for everything.  There is a
way to establish -d2 just for a selected client, however, which is to
set the PGOPTIONS environment variable for the client:
	export PGOPTIONS="-d2"
	psql (or other client program)
libpq will see the PGOPTIONS setting and pass it over to the backend.

			regards, tom lane

In response to

  • log file? at 2001-01-15 07:36:56 from Dan B

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2001-01-16 16:33:47
Subject: Re: LIKE optimization
Previous:From: Nabil SayeghDate: 2001-01-16 16:18:43
Subject: LIKE optimization

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group