pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chen Huajun <chenhj@cn.fujitsu.com>
To: List <pgsql-jdbc@postgresql.org>
Subject: [BUGS]log can not be output when use DataSource
Date: Thu, 17 Jan 2013 12:47:07 +0800
Message-ID: <50F7824B.5080402@cn.fujitsu.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Hi,

In the following code,log can not be output as expected.

-------------------------------------
org.postgresql.Driver.setLogLevel(org.postgresql.Driver.DEBUG);
DataSource source = (DataSource)new InitialContext().lookup("DataSource");
Connection con = source.getConnection();
-------------------------------------

It's seems to be a problem,
I have made a small patch to fix it.
Hopefully this useful.

-- 
Best Regards,
Chen Huajun

-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

Attachments:

pgjdbc_logLevel.patch (text/plain, 710B) download diff --git a/org/postgresql/ds/common/BaseDataSource.java b/org/postgresql/ds/common/BaseDataSource.java index bfe54f7..a6726f9 100644 --- a/org/postgresql/ds/common/BaseDataSource.java +++ b/org/postgresql/ds/common/BaseDataSource.java @@ -486,7 +486,9 @@ sb.append("&socketTimeout=").append(socketTimeout); sb.append("&prepareThreshold=").append(prepareThreshold); sb.append("&unknownLength=").append(unknownLength); - sb.append("&loglevel=").append(logLevel); + if (logLevel != 0) { + sb.append("&loglevel=").append(logLevel); + } if (protocolVersion != 0) { sb.append("&protocolVersion=").append(protocolVersion); }=

view thread (30+ messages)  latest in thread

Message-ID: <50F7824B.5080402@cn.fujitsu.com>
Permalink:  ../50F7824B.5080402@cn.fujitsu.com/
Also on:    postgresql.org/message-id/50F7824B.5080402@cn.fujitsu.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: chenhj@cn.fujitsu.com
  Subject: Re: [BUGS]log can not be output when use DataSource
  In-Reply-To: <50F7824B.5080402@cn.fujitsu.com>
  References: <50F7824B.5080402@cn.fujitsu.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox