Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] messenger:consume doesn't use a logger for startup messages #57776

Closed
@dkarlovi

Description

@dkarlovi

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

  1. 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'
  1. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions