I Want To See Sql Query Generated By Active Record Class Methods


I can’t find a way to view the actual raw sql query generated by the yii active record class built in methods,like count(),find etc.Can any one help me on this.thanks in advance.

All queries are logged with the TRACE loglevel. So if you setup a logging route that is linked to LEVEL_TRACE you get all of that (and tons of other info) nicely in your log.

Hi thank you for your reply but I am very much new to yii so i can’t get your words such as TRACE loglevel,logging route,LEVEL_TRACE etc.It will be very helpful if you kindly mention the steps i have to go through so that i can achieve the goal.pls mention the file path where i can get my log file?

It just involves adding a new logging route, take a look at this page: