Coming from Web-Applications: if I create a normal java tool with only some command prompt output - what is the best way to print those outputs? Using System.out.println, or is there some kind of logger that I'm not aware of?
(apart from including external libs like log4j, which would be overkill for a small tool).
If you don't want to use log4j (which you should), you can use Java's standard logger.
log4j is more popular because of its ease of use, configurability, more intuitive severity levels, and a much nicer default pattern.
A nice tutorial on the standard Java logger can be found here.
A nice tutorial on log4j configured to output to STDOUT (which is the console for console apps) can be found here.
The use of System.our.println is discouraged because you cannot easily disable certain messages that you may have needed at some point (and may need again in the future) for debugging.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With