Function Logging

Started by Andrew Bartleyover 16 years ago9 messagesgeneral
Jump to latest
#1Andrew Bartley
abartley@aimstats.com

Hi All,

We have recently upgraded postgres from 7.2 to 8.3.

I am struggling with the logging options when it comes to functions.

How do log statements from within a Function?

Thanks

Andrew Bartley

#2Craig Ringer
craig@2ndquadrant.com
In reply to: Andrew Bartley (#1)
Re: Function Logging

On 17/08/2009 10:32 AM, Andrew Bartley wrote:

Hi All,

We have recently upgraded postgres from 7.2 to 8.3.

I am struggling with the logging options when it comes to functions.

How do log statements from within a Function?

A PL/PgSQL function?

You don't, generally.

Perhaps we should back up a step or two. Did you have statement logging
within PL/PgSQL functions in 7.2? If so, how? Why do you need statement
logging within functions? What are you trying to achieve with it?

--
Craig Ringer

#3Andrew Bartley
ambartley@gmail.com
In reply to: Craig Ringer (#2)
Re: Function Logging

Thanks Craig fro you reply,

7.2 does have statement logging from within functions.

How? these are the settings we use in our production environments. (7.2)

debug_level = 2
log_connections = off
log_pid = on
log_timestamp = on
syslog = 0

Why, we use logging fro production problem resolution.

We have been using Postgres for 8 years, hundreds of functions have been
written, we have become reliant on logging for production support.

Thanks

Andrew Bartley

PS on this note, how do we log PIDS? This is another "need to have" for our
production systems. We log user activity and trace DB activity through the
PIDS.

2009/8/17 Craig Ringer <craig@postnewspapers.com.au>

Show quoted text

On 17/08/2009 10:32 AM, Andrew Bartley wrote:

Hi All,

We have recently upgraded postgres from 7.2 to 8.3.

I am struggling with the logging options when it comes to functions.

How do log statements from within a Function?

A PL/PgSQL function?

You don't, generally.

Perhaps we should back up a step or two. Did you have statement logging
within PL/PgSQL functions in 7.2? If so, how? Why do you need statement
logging within functions? What are you trying to achieve with it?

--
Craig Ringer

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Andrew Bartley (#3)
Re: Function Logging

Andrew Bartley escribi�:

PS on this note, how do we log PIDS? This is another "need to have" for our
production systems. We log user activity and trace DB activity through the
PIDS.

See log_line_prefix. You can use something like '%p ' (note the space
at the end), or stuff like the session identifier as described in the
docs.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#5Andrew Bartley
ambartley@gmail.com
In reply to: Alvaro Herrera (#4)
Re: Function Logging

Thanks Alvaro,

I still need to be able to log statements from within functions... Can you
help with that?

2009/8/18 Alvaro Herrera <alvherre@commandprompt.com>

Show quoted text

Andrew Bartley escribió:

PS on this note, how do we log PIDS? This is another "need to have" for

our

production systems. We log user activity and trace DB activity through

the

PIDS.

See log_line_prefix. You can use something like '%p ' (note the space
at the end), or stuff like the session identifier as described in the
docs.

--
Alvaro Herrera
http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#6Andrew Bartley
ambartley@gmail.com
In reply to: Andrew Bartley (#5)
Re: Function Logging

So the information i have thus far is that, I am not easily able to log the
statements from a function.

Does anyone know why it was removed... that is it 7.2 logged this
information.

Thanks Again

Andrew Bartley

2009/8/18 Andrew Bartley <ambartley@gmail.com>

Show quoted text

Thanks Alvaro,

I still need to be able to log statements from within functions... Can you
help with that?

2009/8/18 Alvaro Herrera <alvherre@commandprompt.com>

Andrew Bartley escribió:

PS on this note, how do we log PIDS? This is another "need to have" for

our

production systems. We log user activity and trace DB activity through

the

PIDS.

See log_line_prefix. You can use something like '%p ' (note the space
at the end), or stuff like the session identifier as described in the
docs.

--
Alvaro Herrera
http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#7Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Andrew Bartley (#6)
Re: Function Logging

On Monday 17 August 2009 8:50:09 pm Andrew Bartley wrote:

So the information i have thus far is that, I am not easily able to log the
statements from a function.

Does anyone know why it was removed... that is it 7.2 logged this
information.

Thanks Again

Andrew Bartley

You are going to have to show an example of what you want and/or provide a
better description of what you wish to achieve. At this point I ,for one, am
confused as to what you want.

--
Adrian Klaver
aklaver@comcast.net

#8Craig Ringer
craig@2ndquadrant.com
In reply to: Adrian Klaver (#7)
Re: Function Logging

On 18/08/2009 9:26 PM, Adrian Klaver wrote:

On Monday 17 August 2009 8:50:09 pm Andrew Bartley wrote:

So the information i have thus far is that, I am not easily able to log the
statements from a function.

Does anyone know why it was removed... that is it 7.2 logged this
information.

Thanks Again

Andrew Bartley

You are going to have to show an example of what you want and/or provide a
better description of what you wish to achieve. At this point I ,for one, am
confused as to what you want.

It sounds to me like the OP is saying that in 7.2 "log_statement" logged
each statement of a PL/PgSQL function where in 8.3 it does not.

--
Craig Ringer

#9Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Craig Ringer (#8)
Re: Function Logging

On Tuesday 18 August 2009 8:08:39 pm Craig Ringer wrote:

On 18/08/2009 9:26 PM, Adrian Klaver wrote:

On Monday 17 August 2009 8:50:09 pm Andrew Bartley wrote:

So the information i have thus far is that, I am not easily able to log
the statements from a function.

Does anyone know why it was removed... that is it 7.2 logged this
information.

Thanks Again

Andrew Bartley

You are going to have to show an example of what you want and/or provide
a better description of what you wish to achieve. At this point I ,for
one, am confused as to what you want.

It sounds to me like the OP is saying that in 7.2 "log_statement" logged
each statement of a PL/PgSQL function where in 8.3 it does not.

--
Craig Ringer

Now I understand.

Thanks,
--
Adrian Klaver
aklaver@comcast.net