Skip to content

[ErrorHandler] Loggers can only be Monolog’s #51910

Closed
@MatTheCat

Description

@MatTheCat

Symfony version(s) affected

≥ 5.1

Description

#36621 replaced DebugHandlersListener’s loggers for Monolog’s ones. Then, #49275 introduced the ErrorHandlerConfigurator but its loggers are configured the same way.

As a result, HttpKernel’s Logger won’t be passed to the ErrorHandler, even if you’re not using Monolog. That means eg. deprecations won’t appear in the profiler’s logs panel, but they will always appear in commands output (because ErrorHandler’s loggers will be BufferingLoggers).

How to reproduce

In a Symfony project without symfony/monolog-bundle using the profiler, trigger an error or deprecation and it won’t appear in the profiler’s logs panel.

Possible Solution

ErrorHandlerConfigurator::$logger and ErrorHandlerConfigurator::$deprecationLogger could be injected the logger service by default and only be wired to monolog.logger.php or monolog.logger.deprecation if they exist.

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