From 1c9dc9926ae281215fce00b6b1670c868dfcf073 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 3 Oct 2021 06:26:25 +0200 Subject: [PATCH] Add papertrail logging. --- .env.example | 7 +++++++ config/logging.php | 38 +++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/.env.example b/.env.example index 7e3fd239df..f886f98993 100644 --- a/.env.example +++ b/.env.example @@ -37,9 +37,16 @@ TRUSTED_PROXIES= # Several other options exist. You can use 'single' for one big fat error log (not recommended). # Also available are 'syslog', 'errorlog' and 'stdout' which will log to the system itself. # A rotating log option is 'daily', creates 5 files that (surprise) rotate. +# A cool option is 'papertrail' for cloud logging # Default setting 'stack' will log to 'daily' and to 'stdout' at the same time. LOG_CHANNEL=stack +# +# Used when logging to papertrail: +# +PAPERTRAIL_HOST= +PAPERTRAIL_PORT= + # Log level. You can set this from least severe to most severe: # debug, info, notice, warning, error, critical, alert, emergency # If you set it to debug your logs will grow large, and fast. If you set it to emergency probably diff --git a/config/logging.php b/config/logging.php index 1acddbcdc4..08b971e56c 100644 --- a/config/logging.php +++ b/config/logging.php @@ -52,6 +52,7 @@ return [ */ 'channels' => [ + // default channels for 'stack' and audit logs: 'stack' => [ 'driver' => 'stack', 'channels' => ['daily', 'stdout'], @@ -60,27 +61,38 @@ return [ 'driver' => 'stack', 'channels' => ['audit_daily', 'audit_stdout'], ], + 'scoped' => [ + 'driver' => 'custom', + 'via' => FireflyIII\Logging\CreateCustomLogger::class, + ], + 'papertrail' => [ + 'host' => env('PAPERTRAIL_HOST'), + 'port' => env('PAPERTRAIL_PORT'), + ], + + // single laravel log file: 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => envNonEmpty('APP_LOG_LEVEL', 'info'), ], + + // stdout, used in stack 'stack' by default: 'stdout' => [ 'driver' => 'single', 'path' => 'php://stdout', 'level' => envNonEmpty('APP_LOG_LEVEL', 'info'), ], - 'docker_out' => [ - 'driver' => 'single', - 'path' => 'php://stdout', - 'level' => envNonEmpty('APP_LOG_LEVEL', 'info'), - ], + + // daily, used in stack 'stack' by default: 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/ff3-' . PHP_SAPI . '.log'), 'level' => envNonEmpty('APP_LOG_LEVEL', 'info'), 'days' => 7, ], + + // the audit log destinations: 'audit_daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/ff3-audit.log'), @@ -94,26 +106,14 @@ return [ 'tap' => [AuditLogger::class], 'level' => envNonEmpty('AUDIT_LOG_LEVEL', 'info'), ], - 'dailytest' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/test-ff3-' . PHP_SAPI . '.log'), - 'level' => envNonEmpty('APP_LOG_LEVEL', 'info'), - 'days' => 7, - ], - - 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Firefly III Log Robot', - 'emoji' => ':boom:', - 'level' => 'error', - ], + // syslog destination 'syslog' => [ 'driver' => 'syslog', 'level' => envNonEmpty('APP_LOG_LEVEL', 'info'), ], + // errorlog destination 'errorlog' => [ 'driver' => 'errorlog', 'level' => envNonEmpty('APP_LOG_LEVEL', 'info'),