Обсуждение: logging a psql script

Поиск
Список
Период
Сортировка

logging a psql script

От
Ken Kline
Дата:
Hello,  I would like my psql script to log everything that it does.
I set the following

\set ECHO all
\o foo.txt
\qecho

some sql, some ddl, etc...

\o


But foo.txt only contains

DROP
DROP
DROP
CREATE
CREATE
CREATE

I want it to contain everything that I see on the screen, what am I
missing?

Thanks

Ken






Re: logging a psql script

От
Frank Joerdens
Дата:
On Wed, Feb 21, 2001 at 04:51:00PM -0500, Ken Kline wrote:
> Hello,
>    I would like my psql script to log everything that it does.
> I set the following
> 
> \set ECHO all
> \o foo.txt
> \qecho
> 
> some sql, some ddl, etc...
> 
> \o
> 
> 
> But foo.txt only contains
> 
> DROP
> DROP
> DROP
> CREATE
> CREATE
> CREATE
> 
> I want it to contain everything that I see on the screen, what am I
> missing?

Dunno how you do it via \o; what I do is run the postmaster with the
-d 2 option and then log everything to syslogd. This will log every query
in detail. It's very convenient while you're developing and testing,
especially if you run a separate window with

tail -f /wherever/you/write/your/postgres.log

Regards, Frank


Re: logging a psql script

От
"Oliver Elphick"
Дата:
Ken Kline wrote: >Hello, >   I would like my psql script to log everything that it does.

psql -e

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
========================================   "The LORD bless thee, and keep thee; The LORD make his     face shine upon
thee,and be gracious unto thee; The      LORD lift up his countenance upon thee, and give thee      peace."
Numbers 6:24-26 
 




Re: logging a psql script

От
Christopher Sawtell
Дата:
On Thu, 22 Feb 2001 10:51, Ken Kline wrote:
> Hello,
>    I would like my psql script to log everything that it does.

Issue the command "script" before you start psql.
It will record everything you see on you screen provided it is not piped 
into another program such as "more"  or "less".

man script

for the details.

-- 
Sincerely etc.,
NAME       Christopher SawtellCELL PHONE 021 257 4451ICQ UIN    45863470EMAIL      csawtell @ xtra . co . nzCNOTES
ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz
-->> Please refrain from using HTML or WORD attachments in e-mails to me 
<<--



Re: logging a psql script

От
Jeff Duffy
Дата:
On Wed, 21 Feb 2001, Ken Kline wrote:

> Hello,
>    I would like my psql script to log everything that it does.
> I set the following
> 
> \set ECHO all
> \o foo.txt
> \qecho
> 
> some sql, some ddl, etc...
> 
> \o
> 
> 
> But foo.txt only contains
> 
> DROP
> DROP
> DROP
> CREATE
> CREATE
> CREATE
> 

On UNIX/UNIX-like machines, use the script(1) command (man script for
details).

Jeff

-- 
Errors have occurred.
We won't tell you where or why.
Lazy programmers.    -- Hacking haiku