Great question, I am curious to know the other answers that you will receive.
I try to use the “more is better” approach and write down at every step of the way. Does it make great magazines? Yes, but when you debug a problem in a large Java application, you will be grateful for every line of the log that you have. There are also tools (at least grep , awk , sed trio) to help you filter large files.
Another way is to write this registration code, but disable it (if you are using something like log4j at the TRACE level). Thus, if you encounter a problem, you may not have available logs, but this is a one-line change (to lower the logging threshold), and you will begin to generate a lot of data for debugging.
In combination with the previous technique, most journal libraries (again, I rely on my knowledge of log4j again) allow you to adjust the log levels of various Java packages. This means that you can write all of these catch and rethrow log lines as traces and reject logging on lower-level packets to WARN while you hold the top-level packets in DEBUG or TRACE .
source share