From: Chen Huajun <chenhj@cn.fujitsu.com>
To: Dave Cramer <pg@fastcrypt.com>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: [BUGS]log can not be output when use DataSource
Date: Thu, 17 Jan 2013 18:42:44 +0800
Message-ID: <50F7D5A4.2000403@cn.fujitsu.com> (raw)
In-Reply-To: <CADK3HHJaWMQCApXvJzQiH7rf+c+x-J8LBYbs8RvReAYi=Ojz2g@mail.gmail.com>
References: <50F7824B.5080402@cn.fujitsu.com>
<CADK3HHJaWMQCApXvJzQiH7rf+c+x-J8LBYbs8RvReAYi=Ojz2g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
> It's early here but I can't see how this makes it work. It appears that the code that is being replaced is exactly the same except that there is an if statement in front of it ?
>
> org.postgresql.Driver.setLogLevel(org.postgresql.Driver.DEBUG);
here the JVM level's LogLevel is set to be DEBUG.
> DataSource source = (DataSource)new InitialContext().lookup("DataSource");
> Connection con = source.getConnection();
source.getConnection()
-->DriverManager.getConnection(getUrl(), user, password)
->getUrl()
sb.append("&loglevel=").append(logLevel);
here the Connection's LogLevel is set to be the initial value 0(*) via URL,
although nobody set DataSource's LogLevel by calling BaseDataSource.setLogLevel().
I think it's better append "loglevel" to URL only when
BaseDataSource.setLogLevel() was called.
so a Connection created by DataSource.getConnection() can inherit JVM level's LogLevel setting
just like which one created by DriverManager.getConnection().
*)0 is the initial value and not a valid LogLevel,
valid values are INFO (1) and DEBUG (2).
--
Best Regards,
Chen Huajun
(2013/01/17 17:19), Dave Cramer wrote:
> It's early here but I can't see how this makes it work. It appears that the code that is being replaced is exactly the same except that there is an if statement in front of it ?
>
>
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
> On Wed, Jan 16, 2013 at 11:47 PM, Chen Huajun <chenhj@cn.fujitsu.com <mailto:chenhj@cn.fujitsu.com>> wrote:
>
> 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 <mailto:pgsql-jdbc@postgresql.org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
>
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
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, pg@fastcrypt.com
Subject: Re: [BUGS]log can not be output when use DataSource
In-Reply-To: <50F7D5A4.2000403@cn.fujitsu.com>
References: <50F7824B.5080402@cn.fujitsu.com> <CADK3HHJaWMQCApXvJzQiH7rf+c+x-J8LBYbs8RvReAYi=Ojz2g@mail.gmail.com> <50F7D5A4.2000403@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