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
  • 704,970
  • 168
  • 1,303
  • 1,425
hasib32
  • 815
  • 1
  • 13
  • 29

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
  • 83,499
  • 22
  • 207
  • 202
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