Skip to content

Fix: use project logger to prevent duplicate logs in images utility#1202

Open
Samanvitha275 wants to merge 1 commit intoAOSSIE-Org:mainfrom
Samanvitha275:fix-duplicate-logger
Open

Fix: use project logger to prevent duplicate logs in images utility#1202
Samanvitha275 wants to merge 1 commit intoAOSSIE-Org:mainfrom
Samanvitha275:fix-duplicate-logger

Conversation

@Samanvitha275
Copy link

@Samanvitha275 Samanvitha275 commented Feb 28, 2026

Problem:

The images utility initialized its own logger instead of using the project's centralized logging configuration.
This resulted in duplicate log outputs when the module was imported multiple times.

Root Cause:

logging.getLogger(__name__) was used alongside the project's get_logger, causing multiple handlers to attach to the same module logger.

Solution:

Removed the redundant logger initialization and used the project's logging setup consistently.

Impact:

  • Eliminates duplicate log entries
  • Keeps logging behavior consistent across modules
  • No functional behavior changed

Verification:

Ran the module after modification — logs now appear only once and all features work as before.

Fixes #815

@github-actions github-actions bot added backend bug Something isn't working labels Feb 28, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 28, 2026

Walkthrough

A redundant logger initialization was removed from the images utility module. The duplicate logging.getLogger(__name__) declaration was deleted, preserving the existing custom logger configured via get_logger(__name__).

Changes

Cohort / File(s) Summary
Duplicate Logger Cleanup
backend/app/utils/images.py
Removed redundant logger initialization, keeping only the custom get_logger() setup to maintain consistent logging configuration across the module.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

Python

Poem

🐰 Hops with glee, a logger freed,
Duplicate no more! Indeed, indeed!
One true log shall guide the way,
Custom colors brighten every day!

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses issue #815 by removing the duplicate logger on line 29, but does not remove the unused logging module import as required. Remove the unused 'import logging' statement from backend/app/utils/images.py to fully comply with issue #815 requirements.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing a redundant logger initialization to use the project's centralized logger, which directly addresses the duplicate logging issue.
Out of Scope Changes check ✅ Passed The changes are directly in scope: only removing the redundant logger initialization line that was explicitly identified in issue #815.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Samanvitha275
Copy link
Author

Hi maintainers, this fixes duplicate logging caused by multiple handlers in images.py.
Happy to update if any changes are preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Duplicate Logger Initialization in backend/app/utils/images.py

1 participant