Bill,

I do just that, i.e. open the log file for writing in the init() method of a
dumb servlet that gets preloaded at startup.  I pick up the path/filename of
the log file from a context-param which I set in web.xml (and override in
orion-web.xml if necessary).

A better way to do all this would be to use log4j, but I haven't had a
chance to look into it in any depth.

    Hope this helps,

    Attila



----- Original Message -----
From: "Bill Clinton" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Friday, July 20, 2001 6:50 AM
Subject: Re: Datasource Question - is there a way to setup a JDBC log file?


> 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