Re: [BUGS]log can not be output when use DataSource - Mailing list pgsql-jdbc
From | dmp |
---|---|
Subject | Re: [BUGS]log can not be output when use DataSource |
Date | |
Msg-id | 50FC3529.3060101@ttc-cmc.net Whole thread Raw |
In response to | Re: [BUGS]log can not be output when use DataSource (Chen Huajun <chenhj@cn.fujitsu.com>) |
Responses |
Re: [BUGS]log can not be output when use DataSource
|
List | pgsql-jdbc |
Hello Chen, Lets look at the current behavior without your patch of both DriverManager and DataSource. Note: 1. X Indicating Parameter not set 2. Boundary cases <0 and >2 3. DriverManager.getConnection() is the standard as Chen you have stated, which DataSource should duplicate. DriverManager.getConnection(connectionString); Driver.setLogLevel() | ConnectionString &logLevel | Logging X <0 No Logging X 0 No Logging X 1 INFO Logging X 2 DEBUG Logging X >2 DEBUG Logging ---------------------------------------- <0 <0 No Logging <0 0 No Logging <0 1 INFO Logging <0 2 DEBUG Logging <0 >2 DEBUG Logging ---------------------------------------- 0 <0 No Logging 0 0 No Logging 0 1 INFO Logging 0 2 DEBUG Logging 0 >2 DEBUG Logging ---------------------------------------- 1 <0 No Logging 1 0 No Logging You can continue down this path, but the behavior will always be ConnectionString &logLevel overrides Driver.setLogLevel(). Lets May sure we have the last case though in the sequence which on review seems to operate appropriately with logLevel now following Driver.setLogLevel() when logLevel in the connectionString is not set. ----------------------------------------- <0 X No Logging 0 X No Logging 1 X INFO Logging 2 X DEBUG Logging >2 X DEBUG Logging DataSource.getConnection() Driver.setLogLevel() | DataSource.setLogLevel() | Logging X <0 No Logging X 0 No Logging X 1 INFO Logging X 2 DEBUG Logging X >2 DEBUG Logging ---------------------------------------- <0 <0 No Logging <0 0 No Logging <0 1 INFO Logging <0 2 DEBUG Logging <0 >2 DEBUG Logging ---------------------------------------- 0 <0 No Logging 0 0 No Logging 0 1 INFO Logging 0 2 DEBUG Logging 0 >2 DEBUG Logging ---------------------------------------- 1 <0 No Logging 1 0 No Logging Again you can continue down this path and everything looks good with DataSource.setLogLevel() overriding Driver.setLogLevel(). Lets not forget though the last case though which is broken as you pointed out. ----------------------------------------- <0 X No Logging 0 X No Logging 1 X No Logging 2 X No Logging >2 X No Logging Now lets look at the current behavior your patch has which I will present just one case where it breaks the standard set by the DriverManager.getConnection(). DataSource.getConnection() Driver.setLogLevel() | DataSource.setLogLevel() | Logging ----------------------------------------- 1 <0 No Logging 1 0 INFO Logging <<<---- Breaks standard 1 1 INFO Logging 1 2 DEBUG Logging 1 >2 DEBUG Logging Chen, If you would create sample code to run to validate both your bug report and test your patch you may have seen the breakage. I can tell you that in all cases when DataSource.SetLogLevel(0) your patch breaks the standard of the user overrides the Driver.setLogLevel() when it is stipulated. I know that valid inputs maybe only be Driver.INFO & Driver.DEBUG, but if you treat the PgJDBC has a black box which you stimulate and watch the output then we can not ignore the boundard cases of <0, 0, & >2. danap. Chen Huajun wrote: > > danap I am also a bit confused for what's the expected behavior of > PgJDBC driver.
pgsql-jdbc by date: