hgtan / graylog-bundle
Hello Graylog2 Bundle
Installs: 351
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Type:symfony-bundle
This package is not auto-updated.
Last update: 2024-11-23 18:43:29 UTC
README
Connecting logging through Graylog2 to projects on Symfony2 and the following Library:
Installation
Step 1: Using Composer
composer.json
php composer.phar require hgtan/graylog-bundle:dev-master
Step 2 : Register the bundle
Then register the bundle with your kernel:
<?php
// in AppKernel::registerBundles()
$bundles = array(
// ...
new Hgtan\Bundle\HelloGraylogBundle\HgtanHelloGraylogBundle(),
// ...
);
Step 3 : Configure the bundle
# app/config/parameters.yml
parameters:
graylog_host: 172.16.4.105
graylog_port: 12201
# app/config/config.yml
monolog:
handlers:
gelf:
type: service
id: monolog.gelf_handler
level: debug
Step 4 : Test
$ php app/console server:run
http://127.0.0.1:8000/hello/graylog
Example:
$logger = new Logger('Graylog2');
$gelfHandler = $this->get('monolog.gelf_handler');
$logger->pushHandler($gelfHandler);
$logger->warning('Test warning message');
$logger->error('Test error message');
$logger->info('Test info message');
$logger->debug('Test debug message');
http://172.16.4.105:9000/