Skip to content

Stop logging 404s and rotate the app log - #358

Merged
AydinHassan merged 1 commit into
masterfrom
quieter-logs
Oct 24, 2026
Merged

AydinHassan merged 1 commit into
masterfrom
quieter-logs

Conversation

@AydinHassan

Copy link
Copy Markdown
Member

var/logs/app.log on imp is 280MB. About 125,000 of its entries are 404s from bots probing URLs, each logged at ERROR level with a full stack trace.

  • A small ErrorHandler subclass skips logging 4xx HttpExceptions (404, 405 and the like). Responses don't change: they still return the JSON {"error": "..."} body.
  • The logger now writes one file per day (app-YYYY-MM-DD.log) and keeps 14 days.

Tested locally: /api/wp-admin and DELETE /api/posts return 404 and 405 JSON and nothing is logged. Added tests that a 404 isn't logged and a 500 is.

After deploy, the old app.log can be deleted.

Bots probing for URLs logged about 125,000 404s with full stack traces,
and the log was a single file with no rotation, now 280MB.
@AydinHassan
AydinHassan merged commit 59984b6 into master Oct 24, 2026
3 checks passed
@AydinHassan
AydinHassan deleted the quieter-logs branch October 24, 2026 19:50
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