Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvnN4-0007WO-0l for pgsql-jdbc@arkaria.postgresql.org; Thu, 17 Jan 2013 11:10:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TvnN3-0002kQ-El for pgsql-jdbc@arkaria.postgresql.org; Thu, 17 Jan 2013 11:10:57 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvnN2-0002kF-J9 for pgsql-jdbc@postgresql.org; Thu, 17 Jan 2013 11:10:56 +0000 Received: from [222.73.24.84] (helo=song.cn.fujitsu.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvnMx-0002Wn-Rg for pgsql-jdbc@postgresql.org; Thu, 17 Jan 2013 11:10:55 +0000 X-IronPort-AV: E=Sophos;i="4.84,485,1355068800"; d="scan'208";a="6606992" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 17 Jan 2013 19:08:38 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r0HAgEM8018738; Thu, 17 Jan 2013 18:42:16 +0800 Received: from [127.0.0.1] ([10.167.159.99]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013011718412879-995139 ; Thu, 17 Jan 2013 18:41:28 +0800 Message-ID: <50F7D5A4.2000403@cn.fujitsu.com> Date: Thu, 17 Jan 2013 18:42:44 +0800 From: Chen Huajun User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.28) Gecko/20120306 Lightning/1.0b2 Thunderbird/3.1.20 MIME-Version: 1.0 To: Dave Cramer CC: List Subject: Re: [BUGS]log can not be output when use DataSource References: <50F7824B.5080402@cn.fujitsu.com> In-Reply-To: X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/01/17 18:41:28, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/01/17 18:41:31, Serialize complete at 2013/01/17 18:41:31 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Host-Lookup-Failed: Reverse DNS lookup failed for 222.73.24.84 (failed) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org > 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 > 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 ) > 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