Logging

  • Do Not use System.out for logging

  • Use a logging framework

How:

  • acquire logger: private static final LOG = Log.getLogger(Blabla.class);

  • LOG.debug("bla");

  • LOG.info("bla");

  • logger can be configured for different log levels, and separately for each package / subpackage / class

log4j

  • Commonly used

  • Only use in new projects if you have previous experience with it!

commons-logging

  • apache project

  • auto-detects logger from classpath

  • use in libraries

java.util.log

  • built-in since Java 1.4

  • Use in all user tools / gui projects