Skip to content

feat(logging): write warnings to stderr in prod as they happen (#524 follow-up) - #559

Merged
Neophytis merged 1 commit into
feature/docker-masterfrom
neophytis/524-log-warnings
Oct 5, 2026
Merged

Neophytis merged 1 commit into
feature/docker-masterfrom
neophytis/524-log-warnings

Conversation

@Neophytis

Copy link
Copy Markdown
Contributor

Target branch: feature/docker-master (prod builds from it). Follow-up to #524 / #558. Config only; it survives the #519 upgrade.

Why

Since #558 (rox 3.8.1), prod writes only errors, each with the records buffered before it in the same request. Warnings from requests that don't fail are no longer written anywhere. On 3.8.0 that was about 28k a day, and several pointed at real problems:

What

config/packages/prod/monolog.yaml: a warnings filter handler that passes only the warning level, straight to php://stderr as JSON, without a buffer.

  • Errors stay with main, so an error is never written twice.
  • A warning in a request that later fails appears twice: once on its own, once as context of the error. That's about 400 requests a day.
  • Notices, debug and deprecations stay off.

Volume: about 28k lines a day, about 20k once ROX-502 (the alias.cache.ini warning, about 7.5k a day) is fixed. All of VictoriaLogs takes in about 876k rows a day.

Tested

In the rox:3.8.1 image with this config mounted, using a test kernel that exposes the loggers:

Case stderr
normal request (security.DEBUG + app.INFO) nothing
404 nothing
warning only 1 line (php.WARNING)
notice nothing
500 3 lines, CRITICAL once
warning, then 500 in the same request WARNING twice (alone + context), CRITICAL once
deprecation (DEPRECATION_LOG unset) nothing

var/log stayed empty, and debug:config monolog resolves.

After merge (stage)

  • service:php level:warn* fields.channel:* shows warnings in VictoriaLogs.
  • Volume per day: _time:24h env:stage service:php fields.level_name:WARNING | stats count().

…follow-up)

Since #558, prod writes only errors (with their buffered request context).
Warnings from requests that don't fail were no longer written anywhere. On
3.8.0 that was about 28k a day, and they pointed at real problems: the
avatar fallback (#556, which members have unreadable avatar files), header
injection in the language switcher (#550), undecodable sessions (#532).

- warnings: a filter handler that passes only the warning level, straight
  to php://stderr as JSON, no buffer. Errors stay with "main", so an error
  is never written twice. A warning in a request that later fails appears
  twice (alone and as context of the error), about 400 requests a day.
- Deprecations, notices and debug stay off. Volume: about 28k lines a day,
  about 20k once ROX-502 (alias.cache.ini warning) is fixed.
@Neophytis
Neophytis merged commit fa6a635 into feature/docker-master Oct 5, 2026
3 of 11 checks passed
@Neophytis
Neophytis deleted the neophytis/524-log-warnings branch October 5, 2026 13:33
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