Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id A5ACE9FB45B for ; Mon, 19 Feb 2007 10:36:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 04476-01 for ; Mon, 19 Feb 2007 10:35:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from pjetlic.mobart.hr (pjetlic.mobart.hr [80.80.51.10]) by postgresql.org (Postfix) with ESMTP id 7055E9FB39F for ; Mon, 19 Feb 2007 10:35:57 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by pjetlic.mobart.hr (Postfix) with ESMTP id 234D017F58 for ; Mon, 19 Feb 2007 15:35:54 +0100 (CET) Received: from pjetlic.mobart.hr ([127.0.0.1]) by localhost (pjetlic [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03907-04-8 for ; Mon, 19 Feb 2007 15:35:43 +0100 (CET) Received: from mike.mobart.hr (mike.mobart.hr [192.168.10.94]) (using SSLv3 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by pjetlic.mobart.hr (Postfix) with ESMTP id 6867E12BD6 for ; Mon, 19 Feb 2007 15:35:43 +0100 (CET) Subject: Logging failed sql commands trough jdbc? From: Mario Splivalo Reply-To: mario.splivalo@mobart.hr To: pgsql-jdbc@postgresql.org Content-Type: text/plain Organization: Mob-Art d.o.o. Date: Mon, 19 Feb 2007 15:35:43 +0100 Message-Id: <1171895743.5197.24.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by OpenSource AV+AS Mail Server X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/97 X-Sequence-Number: 16653 I'm using pg74.215.jdbc3.jar with PostgreSQL 8.1.2. I'm not using jdbc driver for postgres 8 because of prepared transactions wich makes my postgres log file look like this: 2007-02-19 15:02:51.299 CET [32228] SELECTLOG: duration: 2481.387 ms statement: EXECUTE [PREPARE: select * from update_message_status($1, $2, $3, $4, $5, $6, $7) as result] That log makes debugging realy difficult. Therefore I use jdbc driver for postgres 7.4, because then my postgres log looks like this: 2007-02-19 15:16:24.118 CET [8865] SELECTLOG: duration: 1.280 ms statement: select * from update_message_status('b8b8a9a5-a1d0-44d1-99f9-a057b0e589b5', 20) as result; Now, If, for instance, update_message_status function fails for some reason, the log looks like this: 2007-02-19 15:16:24.083 CET [8860] SELECTERROR: duplicate key violates unique constraint "some_pk" 2007-02-19 15:16:24.083 CET [8860] SELECTCONTEXT: SQL statement "INSERT INTO ticketing_codes (code_id, code_value, code_group_id) VALUES ( $1 , $2 , $3 )" PL/pgSQL function "__internal__ticketing_check_code" line 60 at SQL statement PL/pgSQL function "update_message_status" line 25 at assignment There, again, I can't know what were the parametes that update_message_status was called with. Is there a way to force postgres to display those parameters, or to force JDBC to log all the queries sent to postgres? Even better, can postgres show the parametars in the 'SELECTCONTEXT' line above (instead of $1, $2, $3?) I don't need prepared transactions for production (although I'm not sure about the speed improvement - not that my test were accurate). Mike Mike