Whenever I have PHP problems I'm looking into the Craft CMS logs. However, at first I noticed there's a ton of stuff getting logged which is useless for me. Under this amount of logs, I can't find what I'm looking for so I want to get Craft CMS to stop logging parts.
Mainly the issue is that each and every POST, FILES, COOKIE, and SERVER variable present for any request is being logged. Which adds around 2 pages of text between the useful logging statements.
In the logs it looks as following:
2020-07-31 11:10:35 [-][-][-][info][DEV_migration_import_users] My useful message
$_POST = []
$_FILES = []
$_COOKIE = []
$_SERVER = [
'HOSTNAME' => '...',
'PHP_VERSION' => '7.2.32'
'APACHE_CONFDIR' => '/etc/apache2'
'PHP_MD5' => ''
'PHP_INI_DIR' => '/usr/local/etc/php'
[AND ALL PASSWORDS, DB KEYS, SINGING ETC... at least 2 pages of text]
So I want to remove all these Variables from the logs. How can I do this?
I already tried to find the code where these Variables are logged and found vendor/yiisoft/yii2/base/ErrorHandler.php. But there are other things like "Previous exception:" which are not logged in my case. So this is not the correct code those Server variables are written (commenting out this confirmed it does not help).
PS. Related Problem but solved:
I had the same issue with every single SQL statement ever executed, was logged as well. To remove these SQL statements I found this post: Is it possible to allow logging at LEVEL_INFO without logging all the SQL queries?
Which did help and reduce the huge amount of logs already quite a bit.