How can I limit a program log printouts to a maximum of X printouts within Y seconds?
Programming server side with java.util.logging, my code has a lot of info, warning, and error statements like:
s_logger.logp(Level.WARNING, myClassName, myMethodName, "msg.code.in.properties.file");
On the one hand, I do want to see the warning message above printed to the STDOUT, since it serves an indication that something went wrong, especially when investigating problems in production, but on the other hand, printing numerous lines that tells the same story over a short period of time, has no added value but instead hit performance and introduces scrolling blindness.
What I'm looking for is a mechanism/API that could regulate the printouts to no more than x messages, per message code, during y seconds. For example, over the course of a minute, I don't want to generate and write to the log more than 10 messages of the type: "transaction timed out".
I'd be happy for a API or a library reference, Anyone?