Attila,
     Thanks alot.  I believe this is what I need, but I am going to 
trouble you with one more question:  Where would you recommend doing 
this in a web application?  I was hoping that there would be somewhere 
to set a log file in the definition of the datasource.  I assume I only 
need to set the logWriter once, so could I do it in the init method of a 
dumb servlet that gets preloaded? Or is there a better time and place to 
set the logWriter?

Thanks again for your response
Bill

Attila Bodis wrote:

> Bill,
> 
>       // Use JNDI lookup to locate the data source:
>       InitialContext ctx = new InitialContext(System.getProperties());
>       DataSource ds = (DataSource)ctx.lookup(dsName);
> 
>       // Have the connection pool log to the specified log file:
>       ds.setLogWriter(myPrintWriter);
> 
> Where dsName is the name of your datasource (as specified in
> data-sources.xml) and myPrintWriter is a java.io.PrintWriter object which
> writes to the log file of your choice.
> 
>     Hope this helps,
> 
>     Attila
> 
> 
> ----- Original Message -----
> From: "Bill Clinton" <[EMAIL PROTECTED]>
> To: "Orion-Interest" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 18, 2001 4:37 PM
> Subject: Datasource Question - is there a way to setup a JDBC log file?
> 
> 
> 
>> Hello,
>>    I am curious on how to set up logging for JDBC.  I thought there
>> would be a parameter in the data-source definition that would allow
>> logging.  Does this exist?
>> 
>> Bill
>> 
>> btw: I am using oracle
>> 
>> 
>> 


Reply via email to