0

In Symfony2 logs SQL queries log in XXX.log by default. To check slow query i would like to have log query + its execution time as well. I have created separate log file for doctrine log to do this i need following setting in my config.yml e.g

monolog: handlers: doctrine: action_level: debug type: stream path: %kernel.logs_dir%/%kernel.environment%_doctrine.log channels: doctrine

The doctrine query is logging in my given .log file but the execution time of each query is not there. Please note: i want generic solution, so the logger will log my all queries + time

5
  • Take a look at this post maybe it helps you: stackoverflow.com/questions/22380884/… Commented Feb 4, 2015 at 14:38
  • Thank you, I have checked above given link that is for controller level. I am looking a generic solution, that means some setting to log execution time too for whole project ( each and every controller page). Commented Feb 5, 2015 at 5:11
  • What about creating a listener to log the execution of every controller after kernel response !! Im not sure about the way but im just thinking for a solution. Take a look at this article : matt.drollette.com/2012/06/… Commented Feb 5, 2015 at 9:48
  • I am still trying but again a question is: a single controller will have many methods and each method will have n of sql query (Doctrine) to add listener on controller, will work for each one ( please i am not expert in symfony2)? My assumption will not be work though i am trying.. As per my investigation, monolog is writing the sql message in the given .log file, i am trying to add excutionMS time with that message but i was not able to do it even though i go in death and find doctrine-project.org/api/dbal/2.2/… Commented Feb 5, 2015 at 11:35
  • Good logic.I think the solution is in the ORM layer (Doctrine2).Look at this bundle : github.com/intaro/pinba-bundle Commented Feb 5, 2015 at 13:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.