Some log fine tuning.

This commit is contained in:
James Cole 2016-04-08 14:44:53 +02:00
parent dc4665e82a
commit 8116644526
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
8 changed files with 90 additions and 6 deletions

View File

@ -1,7 +1,7 @@
APP_ENV=production
APP_DEBUG=false
APP_KEY=SomeRandomStringOf32CharsExactly
LOG_LEVEL=warning
DB_CONNECTION=mysql
DB_HOST=localhost

View File

@ -1,7 +1,7 @@
APP_ENV=testing
APP_DEBUG=true
APP_KEY=SomeRandomStringOf32CharsExactly
LOG_LEVEL=debug
DB_CONNECTION=sqlite
DB_HOST=localhost

View File

@ -0,0 +1,43 @@
<?php
/**
* ConfigureLogging.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Bootstrap;
use Illuminate\Log\Writer;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Foundation\Bootstrap\ConfigureLogging as IlluminateConfigureLogging;
/**
* Class ConfigureLogging
*
* @package FireflyIII\Bootstrap
*/
class ConfigureLogging extends IlluminateConfigureLogging
{
/**
* @param Application $app
* @param Writer $log
*/
protected function configureSingleHandler(Application $app, Writer $log)
{
$log->useFiles($app->storagePath().'/logs/firefly-iii.log');
}
/**
* @param Application $app
* @param Writer $log
*/
protected function configureDailyHandler(Application $app, Writer $log)
{
$log->useDailyFiles(
$app->storagePath().'/logs/firefly-iii.log',
$app->make('config')->get('app.log_max_files', 5)
);
}
}

View File

@ -22,6 +22,25 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
*/
class Kernel extends ConsoleKernel
{
/**
* The bootstrap classes for the application.
*
* This needs to be for with the next upgrade.
*
* @var array
*/
protected $bootstrappers = [
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
'FireflyIII\Bootstrap\ConfigureLogging',
'Illuminate\Foundation\Bootstrap\HandleExceptions',
'Illuminate\Foundation\Bootstrap\RegisterFacades',
'Illuminate\Foundation\Bootstrap\SetRequestForConsole',
'Illuminate\Foundation\Bootstrap\RegisterProviders',
'Illuminate\Foundation\Bootstrap\BootProviders',
];
/**
* The Artisan commands provided by your application.
*

View File

@ -29,6 +29,23 @@ use Illuminate\View\Middleware\ShareErrorsFromSession;
*/
class Kernel extends HttpKernel
{
/**
* The bootstrap classes for the application.
*
* Next upgrade should verify these are all here.
*
* @var array
*/
protected $bootstrappers = [
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
'FireflyIII\Bootstrap\ConfigureLogging',
'Illuminate\Foundation\Bootstrap\HandleExceptions',
'Illuminate\Foundation\Bootstrap\RegisterFacades',
'Illuminate\Foundation\Bootstrap\RegisterProviders',
'Illuminate\Foundation\Bootstrap\BootProviders',
];
/**
* The application's global HTTP middleware stack.
*

View File

@ -38,7 +38,6 @@ class MailError extends Job implements ShouldQueue
* @param string $ipAddress
* @param array $exceptionData
*
* @internal param array $exception
*/
public function __construct(User $user, string $destination, string $ipAddress, array $exceptionData)
{

View File

@ -4,7 +4,8 @@ declare(strict_types = 1);
namespace FireflyIII\Providers;
use Illuminate\Support\ServiceProvider;
use Log;
use Config;
/**
* Class AppServiceProvider
*
@ -29,6 +30,10 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
//
// make sure the logger doesn't log everything when it doesn't need to.
$monolog = Log::getMonolog();
foreach ($monolog->getHandlers() as $handler) {
$handler->setLevel(Config::get('app.log-level'));
}
}
}

View File

@ -108,7 +108,8 @@ return [
|
*/
'log' => env('APP_LOG', 'daily'),
'log' => env('APP_LOG', 'daily'),
'log-level' => env('LOG_LEVEL', 'info'),
/*
|--------------------------------------------------------------------------