Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHYVt-0005Lr-5w for pgsql-jdbc@arkaria.postgresql.org; Thu, 15 Dec 2016 16:04:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cHYVs-0001PZ-P1 for pgsql-jdbc@arkaria.postgresql.org; Thu, 15 Dec 2016 16:04:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cHYVO-0000lu-Ch for pgsql-jdbc@postgresql.org; Thu, 15 Dec 2016 16:03:38 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cHYVF-00013m-G3 for pgsql-jdbc@postgresql.org; Thu, 15 Dec 2016 16:03:37 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E493769F4; Thu, 15 Dec 2016 16:03:26 +0000 (UTC) Received: from [10.36.117.27] (ovpn-117-27.ams2.redhat.com [10.36.117.27]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBFG3Kih017568 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Dec 2016 11:03:24 -0500 From: Jeremy Whiting Subject: Re: Re: logging bug in JDBC driver (https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar) To: Brad DeJong , Sergey Kim References: Cc: "pgsql-jdbc@postgresql.org" , Sergey Onuchin Message-ID: <027a7987-01da-9f00-6e42-bf455fcc14c9@redhat.com> Date: Thu, 15 Dec 2016 16:03:20 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------148416148EAA3A42B63F7A66" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 15 Dec 2016 16:03:26 +0000 (UTC) X-Pg-Spam-Score: -10.0 (----------) 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 This is a multi-part message in MIME format. --------------148416148EAA3A42B63F7A66 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 09/12/16 14:14, Brad DeJong wrote: > > Sergey Kim wrote: > > > Brad DeJong wrote: > > >> Sergey Kim wrote: > > >>> ... (loglevel) parameter doesn't produce any messages ... > > >> Please verify that your application calls > java.sql.DriverManager.setLogWriter(PrintWriter) to set the log > destination. > > > The following fix gives solution: > java.sql.DriverManager.setLogWriter(new java.io.PrintWriter(System.out)); > > > What should be do in order to preserve the code untouched and still > have to JDBC logging available? > > Sorry, that is a more difficult question. I am not aware of any way to > set the log writer with a configuration parameter rather than by > calling setLogWriter(). > > As for the change in pgjdbc behavior, I suggest creating an issue on > https://github.com/pgjdbc/pgjdbc. > This has been raised before. See [1]. The advice to call setLogWriter() along with setLogLevel(...) is necessary if using the api is an option. That does not work for url property configuring. I have a commit that adds the ability to load a logLevel property on the URL here [2]. Based on 1212. Jeremy [1] https://github.com/pgjdbc/pgjdbc/issues/452 [2] https://github.com/whitingjr/pgjdbc/tree/logLevel2 --------------148416148EAA3A42B63F7A66 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit
On 09/12/16 14:14, Brad DeJong wrote:

Sergey Kim wrote:

> Brad DeJong wrote:

>> Sergey Kim wrote:

>>> ... (loglevel) parameter doesn't produce any messages ...

>> Please verify that your application calls java.sql.DriverManager.setLogWriter(PrintWriter) to set the log destination.

> The following fix gives solution: java.sql.DriverManager.setLogWriter(new java.io.PrintWriter(System.out));

> What should be do in order to preserve the code untouched and still have to JDBC logging available?

 

Sorry, that is a more difficult question. I am not aware of any way to set the log writer with a configuration parameter rather than by calling setLogWriter().

 

As for the change in pgjdbc behavior, I suggest creating an issue on https://github.com/pgjdbc/pgjdbc.

 


  This has been raised before. See [1].

 The advice to call setLogWriter() along with setLogLevel(...) is necessary if using the api is an option.

  That does not work for url property configuring.  I have a commit that adds the ability to load a logLevel property on the URL here [2]. Based on 1212.

Jeremy

[1]  https://github.com/pgjdbc/pgjdbc/issues/452
[2] https://github.com/whitingjr/pgjdbc/tree/logLevel2

--------------148416148EAA3A42B63F7A66--