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