How to Use Symfony’s Monolog for Logging

Kawasaki KZ750

Kawasaki KZ750


Monolog is the logging bundle for Symfony. It’s super easy to use.

You just need to pull in the “logger” service and call the “error” or “info” method.

In a controller you could do something like this.

$logger = $this->get('logger');
$logger->info("I'm logging over here");
$logger->error("Who dat err?");

Obviously, you can do a lot more than that with Monolog, read the documentation here on Symfony.com.

Share Button