PHP code example of agielks / yii2-log-json
1. Go to this page and download the library: Download agielks/yii2-log-json library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
agielks / yii2-log-json example snippets
'components' => [
// ...
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'agielks\yii2\log\json\FileTarget',
'levels' => ['error', 'warning'],
'except' => [
'yii\web\HttpException:*',
],
],
],
],
// ...
],
'components' => [
// ...
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'agielks\yii2\log\json\LogstashTarget',
'dsn' => '127.0.0.1:5000',
'index' => 'my-index',
'type' => 'log',
'levels' => ['error', 'warning'],
'except' => [
'yii\web\HttpException:*',
],
],
],
],
// ...
],
'components' => [
// ...
// Redis connection
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
// Redis log configuration
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'agielks\yii2\log\json\RedisTarget',
'db' => 'redis',
'levels' => ['error', 'warning'],
'except' => [
'yii\web\HttpException:*',
],
],
],
],
// ...
],