Skip to content

Instantly share code, notes, and snippets.

@piotrpog
Created November 21, 2019 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piotrpog/6da736ead280bd9989173cad05e6ebef to your computer and use it in GitHub Desktop.
Save piotrpog/6da736ead280bd9989173cad05e6ebef to your computer and use it in GitHub Desktop.
Craft CMS log only warning and errors
'components' => [
'log' => function() {
$config = craft\helpers\App::logConfig();
if ($config) {
$config['targets'][0]['includeUserIp'] = false;
$config['targets'][0]['logFile'] = '@storage/logs/web.log';
$config['targets'][0]['enableRotation'] = true;
$config['targets'][0]['maxFileSize'] = 10240;
$config['targets'][0]['maxLogFiles'] = 5;
$config['targets'][0]['levels'] = ['error', 'warning'];
$config['targets'][0]['logVars'] = [];
$config['traceLevel'] = 0;
return Craft::createObject($config);
}
return null;
},
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment