Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version
WARNING: You are browsing the documentation for Symfony 3.3 which is not maintained anymore. Consider upgrading your projects to Symfony 5.1.

How to Enable Logging in Console Commands

3.3 version

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.