Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace LogManager.getLogger() with @Slf4j #2021

Open
AshishBagdane opened this issue Feb 15, 2025 · 1 comment · May be fixed by #2036
Open

Replace LogManager.getLogger() with @Slf4j #2021

AshishBagdane opened this issue Feb 15, 2025 · 1 comment · May be fixed by #2036
Assignees
Labels
good first issue Good for newcomers

Comments

@AshishBagdane
Copy link
Member

Description

Currently, our codebase uses private final Logger logger = LogManager.getLogger(); for logging. We need to replace it with Lombok’s @Slf4j annotation to reduce boilerplate code and improve maintainability.

Why?

  1. Flexibility@Slf4j is a logging abstraction that allows switching between different logging frameworks (e.g., Log4j2, Logback) without modifying the code.
  2. Future-Proofing – Unlike @Log4j, which tightly couples our code to Log4j, @Slf4j ensures we can easily switch to another backend if needed.
  3. Less Boilerplate@Slf4j automatically generates the logger instance, removing the need for explicit declarations like LogManager.getLogger().
  4. Best Practices – Many modern Java projects prefer @Slf4j as it integrates well with different logging backends and provides better adaptability.

Action Items:

  • Replace all occurrences of private final Logger logger = LogManager.getLogger(); with @Slf4j annotation.
  • Ensure no functionality is broken after the migration.
@ideal3147
Copy link

I work on this issue.

@ideal3147 ideal3147 linked a pull request Feb 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants