I second using JMS. Having a JMS server "somewhere" and tomcat as a JMS client. Then all the events are sent to the JMS server. Then the server can decide to consume the messages on demand and log as needed.

-Tim

Allistair Crossley wrote:

this strikes me as being something JMS would handle well, but Tomcat doesn't 
support JMS by default. I have seen people installing openJMS on Tomcat though.

as for the startup/shutdown, that's going to be a Context Listener you want to 
implement and add to web.xml with <listener>.

that's about all i can offer on this, sorry :)


-----Original Message-----
From: Michael Cornell [mailto:[EMAIL PROTECTED]
Sent: 02 December 2004 10:04
To: [EMAIL PROTECTED]
Subject: Asynchronous statistics logger



Hi,

I am trying to implement an asynchronous statistics logger that would load
on startup and be destroyed on shutdown of tomcat. This logger then needs
to write to a log file / to disk / to log4j every x seconds with these
statistics.


Methods to add some statistic to it need to be accessible by all other
classes in the same context (eg public static void addPageHit(String
whatPage, int howBigWasIt); )

I have already tried writing an asynchronous Singleton, but this has caused
major havoc with threading issues (jdk1.4.2 tomcat 5.0.25 redhat linux 9.0).
In addition I know this is not good practice. This singleton was using the
Timer and TimerTask for its implementation.


What is the best practice for implementing this sort of class ?


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



Reply via email to