unidb/log-bundle

Logging helper for the UniDB project

dev-master 2018-04-16 15:12 UTC

README

This bundle unifies logging across the different UniDB applications.

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require unidb/log-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new UniDb\LogBundle\UniDbLogBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Set Log Handler

This step is only required as long as PHP-FPM cannot handle messages longer than ~1000 characters.

In config_dev.yml and config_prod.yml, set the provided ChunkStreamHandler as the used log handler, as follows:

monolog:
    handlers:
        main:
            type:   service
            id: "uni_db_log.chunk_stream_handler"
            level: 'debug'
            channels: ['!event', '!doctrine']