Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tonydub/8594461 to your computer and use it in GitHub Desktop.
Save tonydub/8594461 to your computer and use it in GitHub Desktop.
How to display sql queries with monolog and doctrine channel
<?php
$logger = $this->getContainer()->get('monolog.logger.doctrine');
foreach ($logger->getLogs() as $log) {
$output->writeln(sprintf('<info>Query:</info> %s (%s)', $log['message'], json_encode($log['context'])));
$output->writeln('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment