Thread

  1. logging a psql script

    Ken Kline <ken@oldbs.com> — 2001-02-21T21:51:00Z

    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
    
    
    
    
    
    
  2. Re: logging a psql script

    Jeff Duffy <jduffy@greatbridge.com> — 2001-02-21T22:06:21Z

    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
    
    
    
  3. Re: logging a psql script

    frank@joerdens.de — 2001-02-21T22:36:45Z

    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
    
    
  4. Re: logging a psql script

    Christopher Sawtell <csawtell@xtra.co.nz> — 2001-02-22T09:12:56Z

    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 Sawtell
     CELL PHONE 021 257 4451
     ICQ UIN    45863470
     EMAIL      csawtell @ xtra . co . nz
     CNOTES     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 
    <<--