views:

66

answers:

3

I currently have a web application and wish to add certain statistics to the site. These statistics would be in addition to web statistics.

I can easily log certain events to a file via log4j. Is there something I can add that will investigate the data and format it in a human readable way (chart or table)?

The application is running in tomcat.

A: 

You might want to try JMX and a console that will let you see values at runtime.

duffymo
A: 

You could create an MBean and view it through jmx console. Or add a class that handles the logging, and format it, and then in Log4J you could output that class only to it's own log file. You could then write a parser on that file, and view it via a webpage if necessary.

broschb
A: 

We log events for our web-shop in our database. Something like this

ID-----USER-----EVENTTYPE-----DATE

Then it's easy to create graphs with Google Chart showing logins, orders created, payments done with visa vs mastercard, files download last 30 days etc..

Tommy
Thanks, this is closest to the approach I was considering. How do you parse the data? Do you have to build SQL for each new event (ie what if someone wanted to see a new chart, "logins by day")?
Pool
The eventype is just a number, so you can have one method taking two values; int eventype and int numberOfDays, and with a little group by-sql you get how many logins you have the last N day
Tommy