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.
Loggerobjects are very lightweight, and memory usage is minimized throughstaticdeclaration.