php - Overriding the log interface container binding lumen 5.0 -


i trying override lumen writes logs, 'storage/logs/lumen.log' 'php://stderr'. following code trying, , not work expected.

no errors thrown, , logs still written default location (in storage/logs folder).

and when do:

dd(app('psr\log\loggerinterface')); 

i default implementation.

did misinterpret documentation, or approaching wrong way?

<?php namespace app\providers;  use monolog\logger; use monolog\handler\streamhandler; use monolog\formatter\lineformatter; use illuminate\support\serviceprovider;  class appserviceprovider extends serviceprovider {     /**      * register application services.      *      * @return void      */     public function register()     {         app()->instance('psr\log\loggerinterface', new logger('lumen', [$this->getmonologhandler()]));     }      public function getmonologhandler() {         return (new streamhandler('php://stderr', logger::debug))->setformatter(new lineformatter(null, null, true, true));     } } 

you'll need extend \laravel\lumen\application , override registerlogbindings() and/or getmonologhandler() method set own logging config.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -