Tip: Clean up your symfony debug logs
The symfony web debug toolbar is awesome. You know when partials are executed, you know which queries the database receives, you know all about caching, filters, slots, decorators, and you can even add your own traces there.
But there is one thing that bothers me a lot: each database query executed by Creole displays two or three lines in the web debug toolbar:
{Creole} prepareStatement(): SELECT sf_blog_post.ID, sf_blog_post.AUTHOR_ID, sf_blog_post.TITLE, ...
{Creole} applyLimit(): SELECT sf_blog_post.ID, sf_blog_post.AUTHOR_ID, sf_blog_post.TITLE, ...
{Creole} executeQuery(): [0.70 ms] SELECT sf_blog_post.ID, sf_blog_post.AUTHOR_ID, sf_blog_post.TITLE, ...
I have never needed the first two lines. Only the last one is useful. And the two other lines make the log confusing and too long for no reason. If, like me, you want to clean up your debug toolbar of all the prepareStatement(), applyLimit() and prepareCall() lines, and make it more readable, open the sfDebugConnection class located in symfony/lib/addon/creole/drivers/sfDebugConnection.php, and comment the following lines:
119 //$this->log("{sfCreole} prepareStatement(): $sql");
140 //$this->log("{sfCreole} applyLimit(): $sql, offset: $offset, limit: $limit");
205 //$this->log("{sfCreole} prepareCall(): $sql");
For the same purpose, you may want to remove the “{sfView} initialize view for …” lines. In order to do so, open symfony/lib/view/sfView.class.php and comment:
303 // $context->getLogger()->info(sprintf('{sfView} initialize view for "%s/%s"', $moduleName, $actionName));
Now you have a fast reading execution log.
Possibly related posts (automatically generated):
This a great hack. But how can this be done without hacking symfony ? I think we can’t use a factory configuration to replace this file, but we can change the web_debug filter in filters.yml : web_debug: class: myWebDebugFilter
Maybe a regex just after the line $webDebug = sfWebDebug::getInstance()->getResults(); could do the trick.
And another way to get rid of this fast and obvious hack and keep the log tidy is to improve the debug toolbar.
A filter could be introduced into web debug toolbar, I suppose, that could allow one to filter the log results.
But it’s far too complex, than the way you have suggested
[...] public links >> logs Tip: Clean up your symfony debug logs Saved by vyse102yahoocom on Sun 02-11-2008 Fool Keylogger’s Logs Saved by rascalking on Thu [...]