Closed
Description
Symfony version(s) affected
7.1.2
Description
The messenger:consume
command is meant to be running in non-interactive worker scenarios, but the startup messages are not using the logger subsystem, they're instead produced to output directly, as so (note that shut down messages are correctly logged):
/app $ bin/console messenger:consume --all -vv --env prod --no-interaction
[OK] Consuming messages from transports "async_realtime, async_high_priority, async_normal_priority,
async_low_priority".
// The worker will automatically exit once it has received a stop signal via the messenger:stop-workers command.
// Quit the worker with CONTROL-C.
^C{"@timestamp":"2024-07-19T09:12:03.609016+00:00","@version":1,"host":"f3e3b861766d","message":"Received signal 2.","type":"app","channel":"messenger","level":"INFO","monolog_level":200,"context":{"signal":2,"transport_names":["async_realtime","async_high_priority","async_normal_priority","async_low_priority"]}}
{"@timestamp":"2024-07-19T09:12:03.609719+00:00","@version":1,"host":"f3e3b861766d","message":"Stopping worker.","type":"app","channel":"messenger","level":"INFO","monolog_level":200,"context":{"transport_names":["async_realtime","async_high_priority","async_normal_priority","async_low_priority"]}}
How to reproduce
- Configure Monolog to use Logstash formatter to notice the difference, like so:
monolog:
handlers:
main:
type: stream
path: "php://stderr"
level: "warning"
formatter: 'monolog.formatter.logstash'
channels: ["!deprecation"]
console:
type: console
formatter: 'monolog.formatter.logstash'
- start the
messenger:consume
command like so
bin/console messenger:consume --all -vv --env prod --no-interaction
Possible Solution
Repeat the messages to the logger too? Suppress the plain text messages in non-interactive mode? Both?
Additional Context
No response