Lists: | pgsql-general |
---|
From: | Gordon Shannon <gordo169(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | How to capture an interactive psql session in a log file? |
Date: | 2009-04-03 05:55:10 |
Message-ID: | 22862412.post@talk.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
What I'm trying to do doesn't seem like it should be that difficult or
unusual, but I can't seem to find the right combination of commands to make
it happen. I want to have a log file that captures everything from an
interactive psql session. Running 8.3.7 with bash shell on Linux.
If I use \o <file> or \o |tee <file, it doesn't capture my entered commands,
or any error text.
I can use some fancy bash to capture stderr in the file too, and then error
text goes there, but no matter what, neither the commands I enter nor the
psql prompt will be captured in the log file.
This is even when using -a, or \set ECHO all. It's as if my entered
commands neither go to stdout or stderr.
Has anyone solved this issue before?
Thanks in advance
Gordon
--
View this message in context: http://www.nabble.com/How-to-capture-an-interactive-psql-session-in-a-log-file--tp22862412p22862412.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
---|---|
To: | Gordon Shannon <gordo169(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to capture an interactive psql session in a log file? |
Date: | 2009-04-03 05:58:26 |
Message-ID: | 20090403055826.GA26557@depesz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Thu, Apr 02, 2009 at 10:55:10PM -0700, Gordon Shannon wrote:
> Has anyone solved this issue before?
have you seen program "script"?
usage:
just run script
you will get shell. now run your command you want to capture everything
from - it will work as usual.
after you finish - exit the "script-shell", and check the generated
typescript file
Best regards,
depesz
--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007
From: | Gordon Shannon <gordo169(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to capture an interactive psql session in a log file? |
Date: | 2009-04-03 06:07:12 |
Message-ID: | 22862519.post@talk.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
That does the trick, awesome!
I do think it would be great if psql had a "stderr" capture in addition to
stdout.
Thanks
hubert depesz lubaczewski-2 wrote:
>
> On Thu, Apr 02, 2009 at 10:55:10PM -0700, Gordon Shannon wrote:
>> Has anyone solved this issue before?
>
> have you seen program "script"?
>
> usage:
>
> just run script
> you will get shell. now run your command you want to capture everything
> from - it will work as usual.
> after you finish - exit the "script-shell", and check the generated
> typescript file
>
> Best regards,
>
> depesz
>
> --
> Linkedin: http://www.linkedin.com/in/depesz / blog:
> http://www.depesz.com/
> jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl /
> gg:6749007
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>
--
View this message in context: http://www.nabble.com/How-to-capture-an-interactive-psql-session-in-a-log-file--tp22862412p22862519.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | Gordon Shannon <gordo169(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to capture an interactive psql session in a log file? |
Date: | 2009-04-03 06:54:31 |
Message-ID: | dcc563d10904022354g36d1a9e7wa22f9afa4b788d41@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Thu, Apr 2, 2009 at 11:55 PM, Gordon Shannon <gordo169(at)gmail(dot)com> wrote:
>
> What I'm trying to do doesn't seem like it should be that difficult or
> unusual, but I can't seem to find the right combination of commands to make
> it happen. I want to have a log file that captures everything from an
> interactive psql session. Running 8.3.7 with bash shell on Linux.
Look up the screen command. It's pretty standard on most unixes.
From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to capture an interactive psql session in a log file? |
Date: | 2009-04-03 07:20:32 |
Message-ID: | 20090403072032.GB17375@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
In response to Scott Marlowe :
> On Thu, Apr 2, 2009 at 11:55 PM, Gordon Shannon <gordo169(at)gmail(dot)com> wrote:
> >
> > What I'm trying to do doesn't seem like it should be that difficult or
> > unusual, but I can't seem to find the right combination of commands to make
> > it happen. I want to have a log file that captures everything from an
> > interactive psql session. Running 8.3.7 with bash shell on Linux.
>
> Look up the screen command. It's pretty standard on most unixes.
s/screen/script/
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to capture an interactive psql session in a log file? |
Date: | 2009-04-03 07:26:17 |
Message-ID: | dcc563d10904030026p24a7cceck4d662cc1e6ee9626@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Fri, Apr 3, 2009 at 1:20 AM, A. Kretschmer
<andreas(dot)kretschmer(at)schollglas(dot)com> wrote:
> In response to Scott Marlowe :
>> On Thu, Apr 2, 2009 at 11:55 PM, Gordon Shannon <gordo169(at)gmail(dot)com> wrote:
>> >
>> > What I'm trying to do doesn't seem like it should be that difficult or
>> > unusual, but I can't seem to find the right combination of commands to make
>> > it happen. I want to have a log file that captures everything from an
>> > interactive psql session. Running 8.3.7 with bash shell on Linux.
>>
>> Look up the screen command. It's pretty standard on most unixes.
>
> s/screen/script/
Thanks. I was thinking script, honest. I need to get to sleep.
From: | "Mahlon E(dot) Smith" <mahlon(at)martini(dot)nu> |
---|---|
To: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
Cc: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to capture an interactive psql session in a log file? |
Date: | 2009-04-03 16:18:08 |
Message-ID: | 20090403161808.GZ71035@martini.nu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Fri, Apr 03, 2009, Scott Marlowe wrote:
> On Fri, Apr 3, 2009 at 1:20 AM, A. Kretschmer
> <andreas(dot)kretschmer(at)schollglas(dot)com> wrote:
> > In response to Scott Marlowe :
> >> On Thu, Apr 2, 2009 at 11:55 PM, Gordon Shannon <gordo169(at)gmail(dot)com> wrote:
> >> >
> >> > What I'm trying to do doesn't seem like it should be that difficult or
> >> > unusual, but I can't seem to find the right combination of commands to make
> >> > it happen. I want to have a log file that captures everything from an
> >> > interactive psql session. Running 8.3.7 with bash shell on Linux.
> >>
> >> Look up the screen command. It's pretty standard on most unixes.
> >
> > s/screen/script/
>
> Thanks. I was thinking script, honest. I need to get to sleep.
Though you can log with screen in the same fashion as script with
'C-a H'. :)
--
Mahlon E. Smith
http://www.martini.nu/contact.html
From: | Erik Jones <ejones(at)engineyard(dot)com> |
---|---|
To: | Gordon Shannon <gordo169(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to capture an interactive psql session in a log file? |
Date: | 2009-04-03 16:52:38 |
Message-ID: | 3FCD8AE5-794A-4C4C-BF79-0DC4A39D5955@engineyard.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Apr 2, 2009, at 11:07 PM, Gordon Shannon wrote:
>
> That does the trick, awesome!
>
> I do think it would be great if psql had a "stderr" capture in
> addition to
> stdout.
While the recommendations to use script are perfect for the use case
of capturing everything, including input, I think it's worth
mentioning that there was some discussion not too long ago to give
psql better IO redirection capabilities. The suggestion I like was
something along the lines of
pagila# \o > stdout.txt 2> stderr.txt
as the meaning of that should be immediately obvious to most *nix
users and would also allow
pagila# \o > allout.txt 2>&
and this would default to stdout for backwards compatibility (and
simplicity)
pagila# \o stdout.txt
Erik Jones, Database Administrator
Engine Yard
Support, Scalability, Reliability
866.518.9273 x 260
Location: US/Pacific
IRC: mage2k