Download the PHP package index0h/yii2-log without Composer
On this page you can find all versions of the php package index0h/yii2-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download index0h/yii2-log
More information about index0h/yii2-log
Files in index0h/yii2-log
Package yii2-log
Short Description Many Yii2 log targets
License MIT
Homepage https://github.com/index0h/yii2-log
Informations about the package yii2-log
yii2-log
Different Yii2 log transports
Now available
- ElasticsearchTarget
- LogstashFileTarget
- LogstashTarget
- RedisTarget
Installation
The preferred way to install this extension is through composer.
or add line to require section of composer.json
Usage
Common properties
$emergencyLogFile
, default@app/logs/logService.log
Elasticsearch, Redis and Logstash - are external services, so if they down our logs must be stored in file.
For that ElasticsearchTarget, LogstashTarget, RedisTarget have option $emergencyLogFile
. It's alias to
file where logs will be written on log service is down.
ElasticsearchTarget
Stores logs in elasticsearch. All logs transform to json, so you can simply watch them by kibana.
Extends yii\log\Target, more options see here
Example configuration
Properties
index
, default 'yii' - Elasticsearch index name.type
, default 'log' - Elasticsearch index type.componentName
- Name of yii redis component.
LogstashFileTarget
Extends yii\log\FileTarget, more options see here
Example Yii configuration
Example Logstash configuration (current version 1.3.3)
LogstashTarget
Extends yii\log\Target, more options see here
Example Yii configuration
Example Logstash configuration (current version 1.3.3)
Properties
dsn
, defaulttcp://localhost:3333
- URL to logstash service. Allowed schemas: tcp, udp, unix - for unix sock files.
RedisTarget
Extends yii\log\Target, more options see here
Example Yii configuration
Example Logstash configuration (current version 1.3.3)
Properties
key
, defaultyii_log
- Redis list key.componentName
- Name of yii redis component.
Testing
Run tests from IDE (example for PhpStorm)
- Select Run/Debug Configuration -> Edit Configurations
- Select Add New Configuration -> PHP Script
- Type:
- File: /path/to/yii-phar/.test.php
- Arguments run: run --coverage --html
- OK