0

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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
hasib32
  • 835
  • 1
  • 13
  • 31

2 Answers2

2

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.

Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204
0

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.

Its Aafrin
  • 59
  • 2