Re: Logging SQL queries?

Поиск
Список
Период
Сортировка
От Kevin Brannen
Тема Re: Logging SQL queries?
Дата
Msg-id 3D371A28.30701@nurseamerica.net
обсуждение исходный текст
Ответ на Logging SQL queries?  (Steve Lane <slane@fmpro.com>)
Ответы Re: Logging SQL queries?  (Ralph Graulich <maillist@shauny.de>)
Re: Logging SQL queries?  (Stephane Bortzmeyer <bortzmeyer@nic.fr>)
Список pgsql-general
Stephane Bortzmeyer wrote:
...
> I cannot write this function in Python (because it exists only as a
> safe language), I can do it in Perl but Perl in PostgreSQL does not
> have global variables so I have to openlog() each time (I'm afraid,
> although I didn't benchmark, that it may slow down the
> system.). Before I study C or Tcl, does anyone has a working solution?

You can easily do it Perl, (I do :-) use the Unix::Syslog module.  Just
call openlog() once at the beginning and off you go, able to call
syslog() anywhere you need to.

Ignoring the argument about whether global vars are good or bad, global
vars in Perl are merely fully [package] qualified named vars.
Therefore, you can do:

$main::mylog = "some value";

and if you always reference it that way, e.g.
    print "Log file is $main::mylog\n"
you can use it anywhere in your program; that is in any file and in any
function (truly global).

HTH,
Kevin


В списке pgsql-general по дате отправления:

Предыдущее
От: "Gregory Wood"
Дата:
Сообщение: 7.3 support for IN
Следующее
От: Bruce Momjian
Дата:
Сообщение: PostgreSQL vs. SapDB slashdot discussion