Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MatTheCat opened this issue Oct 9, 2023 · 0 comments
Closed

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

MatTheCat opened this issue Oct 9, 2023 · 0 comments

Comments

@MatTheCat
Copy link
Contributor

MatTheCat commented Oct 9, 2023

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

@MatTheCat MatTheCat added the Bug label Oct 9, 2023
nicolas-grekas added a commit that referenced this issue Oct 12, 2023
…e Monolog Bundle is not registered (MatTheCat)

This PR was squashed before being merged into the 5.4 branch.

Discussion
----------

[FrameworkBundle] Configure `logger` as error logger if the Monolog Bundle is not registered

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | Not sure
| New feature?  | Not sure
| Deprecations? | no
| Tickets       | Fix #51910
| License       | MIT

Commits
-------

b7d25e8 [FrameworkBundle] Configure `logger` as error logger if the Monolog Bundle is not registered
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants