8000 MonologBridge shows deprecation error with Monolog 3.2 · Issue #47096 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
MonologBridge shows deprecation error with Monolog 3.2 #47096
Closed
@gbirke

Description

@gbirke

Symfony version(s) affected

6.1

Description

Monolog 3.2 has made the Logger class final (see Seldaek/monolog@3cba75e ). This might lead to deprecation notices when initializing the Symfony logger

How to reproduce

Manually add Monolog ^3.2 to your composer dependencies
Initialize the Symfony logger in your code, e.g. a CLI command. When the logger is initalized for the first time (with a clean cache), you will get an error message that looks like this:

User Deprecated: The "Monolog\Logger" class is considered final. It may change without further notice as of its next major version You should not extend it from "Symfony\Bridge\Monolog\Logger". {"exception":"[object] (ErrorException(code: 0): User Deprecated: The "Monolog\Logger" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Bridge\Monolog\Logger". at /var/www/vendor/symfony/error-handler/DebugClassLoader.php:330)"} []

Possible Solution

A short-term fix would be to restrict the possible versions of Monolog to any version below 3.2 in the composer.json file of monolog-bridge

The long-term fix would be to change Symfony\Bridge\Monolog\Logger as a facade for a Monolog\Logger instance, possibly wrapping a logger and implementing the Psr\Log\LoggerInterface and Monolog\ResettableInterface for backwards compatibility.

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

      0