yii2-graylog2 Graylog2 log target for Yii2

Graylog2 log target for Yii2

  1. Credits
  2. Installation
  3. Usage
  4. Resources

Credits

Benjamin Zikarsky gelf-php library

Installation

The preferred way to install this extension is through composer. Either run ~~~ php composer.phar require "nex/yii2-graylog2" "" ~~~ or add ~~~ "nex/yii2-graylog2" : "" ~~~ to the require section of your application's composer.json file.

Usage

Add Graylog target to your log component config:

<?php
return [
    ...
    'components' => [
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                'file' => [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
                'graylog' => [
                    'class' => 'nex\graylog\GraylogTarget',
                    'levels' => ['error', 'warning', 'info'],
                    'categories' => ['application'],
                    'logVars' => [], // This prevent yii2-debug from crashing ;)
                    'host' => '127.0.0.1',
                    'facility' => 'facility-name',
                ],
            ],
        ],
    ],
    ...
];

Resources

0 0
2 followers
0 downloads
Yii Version: 2.0
License: BSD-2-Clause
Category: Logging
Developed by: RomeroMsk
Created on: May 30, 2014
Last updated: 9 years ago

Related Extensions