Warning: You are browsing the documentation for Symfony 3.3, which is no longer maintained.
Read the updated version of this page for Symfony 5.3 (the current stable version).
How to Enable Logging in Console Commands
How to Enable Logging in Console Commands¶
In Symfony versions prior to 3.3, the Console component didn’t provide any logging capabilities out of the box and you had to implement your own exception listener for the console.
Starting from Symfony 3.3, the Console component provides automatic error and exception logging.
You can of course also access and use the logger service to log messages.
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.