Logging in Java

  • The simplest way to log in Java is System.out.println(...)
  • That might not be the best for big apps - You lose context
  • A common logging framework built into Spring is SLF4J
  • Features include configurable log format, different log levels, and different output strategies
public class SomeClass {

    private static final Logger logger = LoggerFactory.getLogger(SomeClass.class);

    public void doAThing() {
        logger.info("Did a thing");


17 / 18