diff --git a/src/Illuminate/Foundation/Console/Kernel.php b/src/Illuminate/Foundation/Console/Kernel.php index ce7d0425292d..848c3a427f0b 100644 --- a/src/Illuminate/Foundation/Console/Kernel.php +++ b/src/Illuminate/Foundation/Console/Kernel.php @@ -58,7 +58,6 @@ class Kernel implements KernelContract protected $bootstrappers = [ 'Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', - 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\SetRequestForConsole', diff --git a/src/Illuminate/Foundation/Console/Optimize/config.php b/src/Illuminate/Foundation/Console/Optimize/config.php index fe8876560e6f..e3410179e060 100644 --- a/src/Illuminate/Foundation/Console/Optimize/config.php +++ b/src/Illuminate/Foundation/Console/Optimize/config.php @@ -44,7 +44,6 @@ $basePath.'/vendor/symfony/http-kernel/TerminableInterface.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Application.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php', diff --git a/src/Illuminate/Foundation/Http/Kernel.php b/src/Illuminate/Foundation/Http/Kernel.php index 2cccc5552c5e..cef0bf3928f8 100644 --- a/src/Illuminate/Foundation/Http/Kernel.php +++ b/src/Illuminate/Foundation/Http/Kernel.php @@ -36,7 +36,6 @@ class Kernel implements KernelContract protected $bootstrappers = [ 'Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', - 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', diff --git a/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php b/src/Illuminate/Log/LogServiceProvider.php similarity index 76% rename from src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php rename to src/Illuminate/Log/LogServiceProvider.php index c2c708e6d3de..4cd3b70ea8f5 100644 --- a/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php +++ b/src/Illuminate/Log/LogServiceProvider.php @@ -1,47 +1,52 @@ registerLogger($app); - - // If a custom Monolog configurator has been registered for the application - // we will call that, passing Monolog along. Otherwise, we will grab the - // the configurations for the log system and use it for configuration. - if ($app->hasMonologConfigurator()) { - call_user_func( - $app->getMonologConfigurator(), $log->getMonolog() - ); - } else { - $this->configureHandlers($app, $log); - } + $this->app->singleton('log', function ($app) { + return $this->createLogger($app); + }); } /** - * Register the logger instance in the container. + * Create the logger. * - * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Contracts\Foundation\Application $app * @return \Illuminate\Log\Writer */ - protected function registerLogger(Application $app) + public function createLogger($app) { - $app->instance('log', $log = new Writer( - new Monolog($app->environment()), $app['events']) + $log = new Writer( + new Monolog($app->environment()), $app['events'] ); + if ($app->hasMonologConfigurator()) { + call_user_func( + $app->getMonologConfigurator(), $log->getMonolog() + ); + } else { + $this->configureHandlers($app, $log); + } + return $log; } @@ -119,4 +124,14 @@ protected function configureErrorlogHandler(Application $app, Writer $log) { $log->useErrorLog($app->make('config')->get('app.log_level', 'debug')); } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['log']; + } }