Answer the question
In order to leave comments, you need to log in
How to disable logging in yii2?
Hello, the site is in production, and I noticed that it is quickly getting fat,
I saw that logs are being kept in frontend/runtime/logs.
Is it possible to disable logging for production?
Or is it not worth doing this, but just deleting old logs?
Thank you)
Answer the question
In order to leave comments, you need to log in
Firstly, if your site gets very fat from logs, it means that something is wrong with your site: either your logging for production is not correctly configured (traceLevel, etc.), or you have a bunch of errors on your site. In any case, you need to analyze the logs and understand the reason for such intensive writing in them.
Secondly, logging in production should not be disabled. Information about the errors that have occurred can always be useful.
Bottom line: logs are kept for a reason, they are needed in order to detect errors and the reasons for their execution in time, and this should be done by the person who maintains the site.
To disable it completely, try to remove the line in the config
'bootstrap' => ['log']
Other answers do not recommend doing this, but you can disable it for a while to assess whether the problem is really in it.
It is not necessary to disconnect, it is even harmful. You need to set them up correctly. Show the settings of the log component. In addition, you may have forgotten to set the YII_DEBUG constant to FALSE in production. Check.
In theory, yii stores only the last 50 of them, if not overridden. I would check the permissions to delete. Maybe they don't clean?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question