-
Notifications
You must be signed in to change notification settings - Fork 439
Set custom logger #287
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
Comments
Honestly, I don't know. We should find out a solution. Feel free to propose |
@kaanbasal by design it should be possible to change logger Extension::onStart method, which is not at the moment. has to be fixed. |
I think the problem is hardcoding the 'new ConsoleLogger()' to the command itself. Instead of doing this way, LoggerInterface can be injected and used in the command. On the other hand, IMO the proper way is adding configuration to support 'logger_extension'. In this case you can check if this extension is enabled and if so you can add it. |
The LoggerExtension should set a logger only if it was not set. https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/enqueue/Consumption/Extension/LoggerExtension.php#L34 So you should be able to register your own LoggerExtension with a logger you want before the one created in the command itself. It should just work cuz default loggers are called before runtime ones. |
I did the same thing, and yes it sets the logger, but after that command is also trying to set the logger and it throws the exception mentioned earlier.
edit: Btw I solved it by extending the command with the logger injection and removing the line. But it is a bit hacky solution |
This line has to be fixed |
enqueue-dev/pkg/enqueue/Symfony/Client/ConsumeMessagesCommand.php
Line 126 in 3472424
I am trying to set my custom logger which implements and registered for LoggerInterface, using LoggerExtension but because of this line is setting logger it gives me this error:
The logger modification is not allowed
Can you please explain how can I set my custom logger?
The text was updated successfully, but these errors were encountered: