AOSSIE-Org / AOSSIE-Org/PictoPy

BUG: Inconsistent Logger Usage Across Backend Modules

Open
#1,515 2 comments 0 reactions 0 assignees View on GitHub
bug enhancement possible-duplicate
Dominant language
Python
Stars
283
Forks
679
Avg merge
7d 2h
Merged PRs (30d)
3

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

Three modules use Python's stdlib logging.getLogger directly instead of the project's own get_logger from app.logging.setup_logging. This means their log output bypasses the ColorFormatter, component-level prefixes, and environment-level filtering configured in setup_logging.py.

### Affected files

| File | Problem |
|------|---------|
| `backend/app/utils/images.py` | `get_logger` assigned correctly on line 35, then **silently overwritten** by `logging.getLogger` on line 41 |
| `backend/app/routes/face_clusters.py` | Uses `logging.getLogger` directly; all 7 sibling route files use `get_logger` |
| `backend/app/routes/models.py` | Uses `logging.getLogger` directly; all 7 sibling route files use `get_logger` |

### Root Cause

`images.py` has a duplicate logger definition the second one overwrites the
first:

```python
# Line 35 — correct
logger = get_logger(__name__)

# Line 41 — overwrites the above, bypassing all custom setup
logger = logging.getLogger(__name__)
```

`face_clusters.py` and `models.py` simply never adopted the project logger
pattern that every other route module follows.

### Record

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.