3

I have a worker that needs to retry consuming some messages until an external service is available to store them, which is only available on work hours, but the events can be generated at any time.

Everything is working as expected, and I'm logging both stderr and stout for traceability purposes. This is a business decision and there's now way around it, so no .log files. But symfony messenger seems to be outputting massive amounts of data, mostly related to redelivery and delay stamps, and my logs are getting out of hand.

These outputs have no valuable information and seem to be serialized stamps. And there's thousands of them every hour:

:67:\\\"\\0Symfony\\\\Component\\\\Messenger\\\\Stamp\\\\RedeliveryStamp\\0...
:51:\\\"\\0Symfony\\\\Component\\\\Messenger\\\\Stamp\\\\DelayStamp\\0delay...

I have no custom middlewares and nothing is printed in my own code.

I tried configuring monolog to ignore messenger and doctrine related entries with no luck:

channels: ["!event", "!doctrine", "!messenger", "!security"]

This is what my messenger.yaml looks like:

framework:
    messenger:
        failure_transport: failed

        transports:
            failed: 'doctrine://default?queue_name=failed'
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                retry_strategy:
                    max_retries: 14400
                    delay: 300000
                    multiplier: 1
                    max_delay: 300000
                options:
                    queue_name: redacted_queue_name
        routing:
            'App\Domain\UserCreatedEvent [async]

Am I missing some obvious way to disable this output?

Edit: this is what my monolog.yaml looks like:

monolog:
    handlers:
        main:
            type: fingers_crossed
            action_level: error
            handler: nested
            excluded_http_codes: [404, 405]
            path: "php://stdout"
            channels: ["!event", "!doctrine", "!messenger", "!security"]
        nested:
            type: stream
            path: "php://stdout"
            channels: ["!event", "!doctrine", "!messenger", "!security"]
        console:
            level: warning
            type: console
            process_psr_3_messages: false
            channels: ["!event", "!doctrine", "!messenger", "!security"]
        deprecation:
            type: stream
            path: "php://stdout"
        deprecation_filter:
            type: filter
            handler: deprecation
            max_level: info
            channels: ["php"]
TheosK
  • 31
  • 6
  • Have you configured monolog for `dev` and `prod` environments? – Artem Apr 21 '21 at 18:45
  • Hi @Artem, yes, that same configuration is included in both: config/packages/dev/monolog.yaml config/packages/prod/monolog.yaml Every single item is pointing to stdout, which is why I find it strange that the unwanted output is being sent through stderr. – TheosK Apr 26 '21 at 06:14
  • Could you provide the monolog.yaml ? – Artem Apr 28 '21 at 15:53
  • Hi @Artem, sorry I took so long, I just came back to this issue. I updated the question to include what my monolog.yaml looks like. Thanks! – TheosK May 31 '21 at 07:52

0 Answers0