Writing to a log file
posted 7 years ago
I don't think there is a "best" way. The feature that util.logging and libraries like Log4J bring to the table is the ability to log at different levels (a DEBUG level for lots of information, INFO for some information, ERROR for just the errors) and to switch what levels are reported (or even what classes are reporting what level) without changing code or recompiling. If you don't need that feature, just opening a file and passing it around may be enough for your purposes. It is very handy, however, to not have to comment/uncomment code every time you go on a bug hunt.