java) logger declaration method

Logger Declaration Method

1private static final Logger logger = LoggerFactory.getLogger({{class name}}.class);
  • Easily identify which class the log originated from.
  • Declaring a logger for each class allows for flexible logging configurations.
  • Initialized only once at the time of class loading.
    • Reuses the same logger.
    • Logger objects are very lightweight, and memory usage is minimized through static declaration.

Post
Category
Series