0

I can only assume this is the reason as there are a lot of DB queries happening on my site and I am not familiar with Laravel My server memory is increasing constantly to the point of the server dying so is there a way to disable the query logging completely without editing every page that is doing DB queries?

3 Answers 3

7

You can disable query logs like this:

For single connection:

DB::connection('CONNECTION_NAME')->disableQueryLog();

For whole DB:

DB::disableQueryLog();

Documentation:

https://laravel.com/api/5.8/Illuminate/Database/Connection.html#method_disableQueryLog

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

Comments

1

Search the project for: enableQueryLog then remove it. https://laravel.com/docs/5.0/database#query-logging

You might also want to visit storage/logs and clear those out.

9 Comments

sorry should have said, this is v4.0
4.2 has DB::connection()->disableQueryLog(); 4.0 though, not 100% sure. Have you tried searching the project for Log::?
Actually 4.1. Added DB::disableQueryLog(); DB::connection()->disableQueryLog(); to artisan.php - made no difference. dunno how you add code here
Every new page that is visited I see the server buff/cache memory go up and up and up.
Might not be artisan.php - what about adding it to your controller(s)?
|
0

If you want to also clear the query log, use DB::flushQueryLog().

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.