Laravel : How to Log INFO to separate file

后端 未结 5 1114
轻奢々
轻奢々 2020-12-13 05:48

How to specify a separate file for logging INFO in Laravel 5.1?

Any immediate help will be highly appreciable. Thanks

5条回答
  •  误落风尘
    2020-12-13 06:30

    If you would like add another monolog handler, you may use the application's configureMonologUsing method.

    Place a call to this method in bootstrap/app.php file right before the $app variable is returned:

    $app->configureMonologUsing(function($monolog) {
        $monolog->pushHandler(new StreamHandler('path/to/info.log', Logger::INFO, false)); // false value as third argument to disable bubbling up the stack
    });
    
    return $app;
    

提交回复
热议问题