FWIW, I do action logging like this, and instead of going straight to
the database I write to a (buffered) file. I then have a class that
reads the log, massages it, and puts it in the database for reporting.
Unless you need the log to be in the database right away for some
reason, it's probably much cheaper and easier to go to a file.
Rod McChesney, Korobra
Randy Belknap wrote:
>
> >* Does the log() implementation write directly to an underlying file,
> > or does it just queue messages to an in-memory buffer that is
> > flushed asynchronously by a background thread?.
> >
>
> Craig,
>
> I've got an application that has to log some high level events (log in, document
>views, etc.) My appLog() method currently inserts these events directly into the
>Oracle database and is unsynchronized. I've been thinking about replacing this with
>a system like you describe above, but am not sure about the
>synchronization/performance issues. Do you have some recommendations?
>
> What I was thinking was to have the appLog() method add the events into a List (I'm
>using 1.1 collections) and then a timed process drain the List and write the events
>to the database.
>
> If I did it this way, would I have to synchronize adding elements to the List?
>Should the background process lock the List and copy it to a new List for processing?
>
> List tempList = listOfEvents; //listOfEvents is List used to log events
> listOfEvents = new ArrayList();
>
> Thanks,
>
> Randy
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html