Summary of "Spring Boot 3 | Session 87 | Logging | Logs | Loggers | Log Levels | SLF4J in Spring Boot"

What logging is and why it matters

Logging is the recording of events, messages, errors and execution flow produced by an application (typically including timestamp, class, message and level). Common uses:

Real-world benefit: you can search historical logs (by date/time, user id, email) to verify if/when a request occurred and diagnose failures.

Why not use System.out.println

Logging frameworks and Spring Boot defaults

How to add logs in your code (recommended practice)

  1. Create a logger instance per class:
    • Example:
      • private static final Logger log = LoggerFactory.getLogger(MyClass.class);
    • Use the class you are in (passing the wrong class will record the wrong origin).
  2. Replace System.out prints with log.* calls so all methods in the class can use the same logger.
  3. Use overloaded log methods to include formatted messages and exceptions:
    • log.info("msg {}", arg);
    • log.error("msg", ex);

Logger levels and behavior

Enabling DEBUG/TRACE example (application.properties):

Log output and operational features

A typical log line contains timestamp (including milliseconds), log level, application name/context, originating class/package and message.

Example: 2026-03-22 12:34:56.789 INFO my-app com.example.MyService - Operation completed

Operational features:

Best practices & tips

Tutorial / guide checklist (what the video demonstrates)

  1. Replace System.out.println traces with LoggerFactory.getLogger(...) and log.info(...) calls.
  2. Show how Spring Boot prints richer log output (timestamp, class, app name) compared with System.out.
  3. Create logger in controller and service classes and demonstrate that logs show the class origin.
  4. Demonstrate default behavior: INFO/WARN/ERROR visible; DEBUG/TRACE not until enabled.
  5. Show how to enable debug in application.properties and observe verbose internal logs.
  6. Explain production workflows: log file rotation/archiving and how support teams use logs to investigate incidents.

Topics signaled for follow-up

Main speakers / sources

Category ?

Technology


Share this summary


Is the summary off?

If you think the summary is inaccurate, you can reprocess it with the latest model.

Video