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.

1

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

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.