Thread: Function Logging

Function Logging

From
"Andrew Bartley"
Date:

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

Re: Function Logging

From
Craig Ringer
Date:
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

Re: Function Logging

From
Andrew Bartley
Date:
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>
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

Re: Function Logging

From
Alvaro Herrera
Date:
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.

Re: Function Logging

From
Andrew Bartley
Date:
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.

Re: Function Logging

From
Andrew Bartley
Date:
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>
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.


Re: Function Logging

From
Adrian Klaver
Date:
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

Re: Function Logging

From
Craig Ringer
Date:
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

Re: Function Logging

From
Adrian Klaver
Date:
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