Reputation: 835
I am new to Laravel PHP framework. Is there any way to see executed queries from terminal. The default log file only giving me exception error. I also tried with profiler which give the queries in the browser but I want to see it from terminal.
Upvotes: 0
Views: 846
Reputation: 59
In Laravel 3 the profiler can be enabled to true at application/config/application.php and application/config/database.php. You will get a query log in the bottom of the page.
In Laravel 4, the DB::getQueryLog() can be used.
Upvotes: 0
Reputation: 87719
You can add this to your app/start/global.php:
DB::listen(function($sql, $bindings, $time) {
Log::info($sql);
});
And then they will automatically appear in your log file.
Upvotes: 2