Re: [BUGS]log can not be output when use DataSource

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Chen Huajun <chenhj(at)cn(dot)fujitsu(dot)com>
Cc: dmp <danap(at)ttc-cmc(dot)net>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [BUGS]log can not be output when use DataSource
Date: 2013-01-21 11:21:50
Message-ID: CADK3HHJ71-or6kcrg8YytLJc00ZU6M7LRkAdvqhgK1U1d=EsiA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Mon, Jan 21, 2013 at 5:27 AM, Chen Huajun <chenhj(at)cn(dot)fujitsu(dot)com> wrote:

> Hi
>
>
>
>> > 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.
>>
>>
> I made a new patch to avoid the above problem.
>
>
> But i found a new another problem.
> In the following code,source2.getConnection() fail to output log as
> expected.
> ------------------------------**----------
> PGPoolingDataSourcesource = new PGPoolingDataSource();
> source.setLogLevel(2);
> Connection con = source.getConnection();//OK, log does output
>
> Properties props = new Properties();
> props.put(InitialContext.**INITIAL_CONTEXT_FACTORY,
> "org.postgresql.test.util.**MiniJndiContextFactory");
> InitialContext initialContext = new InitialContext(props);
> initialContext.rebind("**DataSource", source);
>
> BaseDataSource source2 = (BaseDataSource) initialContext.lookup("**
> DataSource");
> con = source2.getConnection();//NG, log does not output
> ------------------------------**----------
>
> The reason is that loadBaseDataSource(**BaseDataSource ds, Reference ref)
> fail to copy all properties from ref when source2 was created.
> So the loglevel of source2 remains to be the defualt value 0.
> Not only loglevel, some other properties such as "ssl" have the same
> problem.
>
>
>
I would not expect it to copy the loglevel property. Why do you expect this
behaviour, is there a specification that you can refer me to ?

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Chen Huajun 2013-01-21 12:42:07 Re: [BUGS]log can not be output when use DataSource
Previous Message Chen Huajun 2013-01-21 10:27:36 Re: [BUGS]log can not be output when use DataSource