Skip to content

Instantly share code, notes, and snippets.

Created November 8, 2013 15:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Pushing the ConsoleHandler to the Monolog "app" logger instance in Symfony2
// ... see
namespace Acme\DemoBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
class GreetCommand extends Command
protected function configure() { ... }
protected function execute(InputInterface $input, OutputInterface $output)
$container->get('logger')->pushHandler(new ConsoleHandler($output));
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment