Loggin SQL Statements from JBOSS/JDBC

Started by Thomas LeBlancover 22 years ago4 messagesgeneral
Jump to latest
#1Thomas LeBlanc
thomasatiem@hotmail.com

Are there settings in PostgreSQL to log SQL Statements from client apps?

Is yes, where are they logged to?

We set log_statement=On, but where does the log get sritten to?

Thanks,
Thomas LeBlanc

_________________________________________________________________
MSN Shopping upgraded for the holidays! Snappier product search...
http://shopping.msn.com

#2Richard Huxton
dev@archonet.com
In reply to: Thomas LeBlanc (#1)
Re: Loggin SQL Statements from JBOSS/JDBC

On Friday 14 November 2003 16:15, Thomas LeBlanc wrote:

Are there settings in PostgreSQL to log SQL Statements from client apps?

Is yes, where are they logged to?

We set log_statement=On, but where does the log get sritten to?

Depends on how you start PG - you'll need to check your startup scripts.

If you want to, you can set it up to use syslog (set syslog=2, see the
relevant section of the manuals)

--
Richard Huxton
Archonet Ltd

#3Thomas LeBlanc
thomasatiem@hotmail.com
In reply to: Richard Huxton (#2)
Re: Loggin SQL Statements from JBOSS/JDBC

Where are the log files written?

Thanks,
Thomas LeBlanc

From: Richard Huxton <dev@archonet.com>
To: "Thomas LeBlanc" <thomasatiem@hotmail.com>,pgsql-general@postgresql.org
Subject: Re: [GENERAL] Loggin SQL Statements from JBOSS/JDBC
Date: Fri, 14 Nov 2003 17:07:37 +0000

On Friday 14 November 2003 16:15, Thomas LeBlanc wrote:

Are there settings in PostgreSQL to log SQL Statements from client apps?

Is yes, where are they logged to?

We set log_statement=On, but where does the log get sritten to?

Depends on how you start PG - you'll need to check your startup scripts.

If you want to, you can set it up to use syslog (set syslog=2, see the
relevant section of the manuals)

--
Richard Huxton
Archonet Ltd

_________________________________________________________________

From Beethoven to the Rolling Stones, your favorite music is always playing

on MSN Radio Plus. No ads, no talk. Trial month FREE!
http://join.msn.com/?page=offers/premiumradio

#4Richard Huxton
dev@archonet.com
In reply to: Thomas LeBlanc (#3)
Re: Loggin SQL Statements from JBOSS/JDBC

On Friday 14 November 2003 17:08, Thomas LeBlanc wrote:

Where are the log files written?

Usually somewhere in /var/log/ but it depends on your startup script. If
you're on RedHat Linux and using the RPMs then your startup script is
/etc/init.d/postgresql and it seems to redirect to /dev/null (around line
157).

Personally, I like to log via syslog. In your postgresql.conf set:
syslog = 2
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'

In /etc/syslog.conf add:
# Postgresql logfile
local0.* /var/log/postgresql

touch /var/log/postgresql

Add /var/log/postgresql to /etc/logrotate.d/syslog so you logs get recyled and
then:
service syslog restart
service postgresql restart

These are for RedHat Linux, but the process will be similar on most unix-like
systems.
--
Richard Huxton
Archonet Ltd