Skip to content

Reduce settings log noise#137

Open
NaitikRishu wants to merge 2 commits intom2b3:mainfrom
NaitikRishu:reduce-settings-log-noise
Open

Reduce settings log noise#137
NaitikRishu wants to merge 2 commits intom2b3:mainfrom
NaitikRishu:reduce-settings-log-noise

Conversation

@NaitikRishu
Copy link
Copy Markdown

Summary

This PR removes noisy startup logging from Django settings and makes SQL query logging opt-in in debug mode.

Problem

While running locally, settings were printing runtime config values at startup (including DB/Redis-related values), and SQL query logging was always enabled when DEBUG=True, which created excessive log noise.

Changes

  • Removed raw print(...) calls from myapp/settings.py
  • Added LOG_SQL_DEBUG env var (default False)
  • SQL query logging (django.db.backends) now only enables when:
    • DEBUG=True
    • LOG_SQL_DEBUG=True
  • Updated env documentation:
    • .env.example
    • docs/ENV_TEMPLATE.md

Why

  • Avoids exposing runtime config values in logs
  • Keeps local logs cleaner by default
  • Still allows SQL-level debugging when explicitly needed

Validation

  • poetry run python manage.py check passed
  • poetry run python manage.py migrate --noinput passed

@NaitikRishu
Copy link
Copy Markdown
Author

Issue observed during local setup: settings printed runtime config values and always enabled SQL query logs in debug mode, which made logs noisy and harder to use. This PR removes the prints and introduces LOG_SQL_DEBUG so SQL logging is explicit and opt-in.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant