Re: Logging SQL queries? - Mailing list pgsql-general

From Ralph Graulich
Subject Re: Logging SQL queries?
Date
Msg-id Pine.LNX.4.21.0207190042140.11568-100000@shauny.shauny.de
Whole thread Raw
In response to Re: Logging SQL queries?  (Kevin Brannen <kevinb@nurseamerica.net>)
List pgsql-general
Hi,

just my two cents worth tho. I'd love having some kind of "internal log
facility", which means being able to do the follwing:

a) using log functions in every place where common SQL is allowed, which
counts for
    - selects, updates, inserts, deletes (in transaction blocks)
    - triggers
    - functions

b) setting a log level

c) setting which log levels (and greater) really get logged

For example:

    CREATE FUNCTION foobar RETURNS INTEGER AS '
    DECLARE
    ...
    BEGIN
     ...
     IF ...
       LOG('executing if-branch in foobar for value = ' || someval, 2);
     END IF;
     ...
    ...
    END;
    ' LANGUAGE 'plpgsql';

So within any application or psql session one can decide what gets logged
by using:

    SET LOGLEVEL TO 1;

which means logging all messages with a level of 1 or higher.

Just a proposal for future enhancement probably. Open for any comments,
requests... what do others think about that debugging possibility?


Kind regards
... Ralph ...



pgsql-general by date:

Previous
From: nconway@klamath.dyndns.org (Neil Conway)
Date:
Subject: Re: Appropriate values for sort_mem and shared_buffers
Next
From: Tom Lane
Date:
Subject: Re: Bad HTML in Mail List Archives