Give us code for being thread safe then - i always avoided that stuff!

My suggestions:- 

If voumes are low - use Log4J or similar - minimal work

If you have a really fast database do it from a normal class, key DB table on
the URL - the database locking will take care of concurrent access issues. good
old database...

If you have high volumes.
1 - do it in a small singleton class so synchronized code is quick.
2 - don't write output for every hit logged. Save data in an arraylist or if
many pages (so it's big) an HaspMap. Write data to disk every 5 minutes or
after every 50 messages logged (which ever happens 1st) - both these numbers
being parms, so you can tune & switch off the logging.
I'd guess there'd be some code for this somewhere on the internet..
hope that helps..



--- "Galbreath, Mark" <[EMAIL PROTECTED]> wrote:
> Just create a thread-safe counter in the constructor and write it to a
> textfile.
> 
> Mark
> 
> -----Original Message-----
> From: Caoilte O'Connor [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 12, 2002 1:21 PM
> To: [EMAIL PROTECTED]
> Subject: the best way to log action "hits"
> 
> 
> Hi,
> I need to change my webapp to log the number of hits certain
> actions get and from which session etc etc. Can anyone point me towards
> the "right" way to look at doing this. Ideally I would use Log4J or
> something
> similar, but I'm a bit worried about having to parse lots
> of large text files every time my boss wants a gander (especially if he
> insists on having it done as a jsp page).
> 
> I know this isn't strictly struts related, but any stabs at how other people
> have done *in their struts app* appreciated,
> 
> Caoilte
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to