views:

49

answers:

2

During last time I made many integrations (data transfer from one place to another, including DB,SSH,FTP,etc), and for each I need to log some statistics (e.g. how many files updated, how many db rows inserted, errors occurred, etc). All this integrations work once per day and until some error occurred, i'm not interested in logs. But when error occur, i need some statistics for previous runs. Basically I done 5-10 int variables in main class, and output them to log at the end. But it is not very convenient to create each time multiple variables, and then code to output them. Also in current, it will be 20+ statistic variables for various places (so i need at least separate class for them).

I just wonder if there is already some Java library that can help me.

Basically in code I want:

statistics.increase(counterName); //to increase counter
statistics.out(); //to get string of somehow formatted statistics
statistics.out(counterName); //to get string for specific counter

Ideally:

could work with no configuration
support for slf4j
statistics.adjust(counterName, value);
statistics.addcounter(counterName, tagName, initial value, increment);
statistics.outTag(tagName); //output counters with specific tag
A: 

I would think about Apache Camel or Spring Batch, maybe.

Riduidel
hm.. they look like a big framworks. I need something small and simple instead.
kusoksna
A: 

You might look at the java version of rrdtools : JRobin, http://www.jrobin.org/index.php/Main_Page .

It's been a while but you just configure it and dump data to it regularly and it aggregates the data per hour, day, week, month, ...

It has the nice property to give overviews detailed in the shortterm and increasingly granular in the long term and the database stays a fixed size.

Peter Tillemans
JRobin is more like a visualization tool. I need data collecting tool. Statistics will be separate per integration, and output with logs. Sorry, if my description isn't well.
kusoksna
Your description is fine. Thanks for the feedback.
Peter Tillemans