Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Update logging for Laravel 5.6 #1221
James Cole47c9f1e9b8e7
diff --git a/.env.docker b/.env.dockerindex 4fae4718c9..c176b40fce 100644--- a/.env.docker+++ b/.env.docker@@ -17,6 +17,9 @@ APP_KEY=${FF_APP_KEY}APP_URL=${APP_URL}TRUSTED_PROXIES=${TRUSTED_PROXIES}+# The log channel defines where your log entries go to.+LOG_CHANNEL=${LOG_CHANNEL}+# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III# If you use SQLite, set connection to `sqlite` and remove the database, username and password settings.DB_CONNECTION=mysqldiff --git a/.env.example b/.env.exampleindex aa23f9660a..1ce079c0ab 100644--- a/.env.example+++ b/.env.example@@ -21,6 +21,9 @@ TZ=UTCAPP_URL=http://localhostTRUSTED_PROXIES=+# The log channel defines where your log entries go to.+LOG_CHANNEL=daily+# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III# If you use SQLite, set connection to `sqlite` and remove the database, username and password settings.DB_CONNECTION=mysqldiff --git a/.env.heroku b/.env.herokuindex 9b16f9ab93..b1d6a763f5 100644--- a/.env.heroku+++ b/.env.heroku@@ -21,6 +21,9 @@ TZ=UTCAPP_URL=http://localhostTRUSTED_PROXIES=+# The log channel defines where your log entries go to.+LOG_CHANNEL=syslog+# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III# If you use SQLite, set connection to `sqlite` and remove the database, username and password settings.DB_CONNECTION=pgsqldiff --git a/.env.sandstorm b/.env.sandstormindex 42c3108dac..811c71e343 100755--- a/.env.sandstorm+++ b/.env.sandstorm@@ -21,6 +21,9 @@ TZ=UTCAPP_URL=http://localhostTRUSTED_PROXIES=+# The log channel defines where your log entries go to.+LOG_CHANNEL=syslog+# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III# If you use SQLite, set connection to `sqlite` and remove the database, username and password settings.DB_CONNECTION=mysqldiff --git a/.env.testing b/.env.testingindex 1b9f7ab7f2..2e91b05f20 100644--- a/.env.testing+++ b/.env.testing@@ -28,6 +28,9 @@ REDIS_HOST=127.0.0.1REDIS_PASSWORD=nullREDIS_PORT=6379+# The log channel defines where your log entries go to.+LOG_CHANNEL=dailytest+MAIL_DRIVER=logMAIL_HOST=smtp.mailtrap.ioMAIL_PORT=2525diff --git a/bootstrap/app.php b/bootstrap/app.phpindex 67b0a03ed3..8848f99d89 100644--- a/bootstrap/app.php+++ b/bootstrap/app.php@@ -70,38 +70,6 @@ $app->singleton(FireflyIII\Exceptions\Handler::class);-///* Overrule logging if not Sandstorm */-//if (!(env('IS_SANDSTORM') === true)) {-// $app->configureMonologUsing(-// function (Logger $monolog) use ($app) {-//-// $interface = php_sapi_name();-// $path = $app->storagePath() . '/logs/ff3-' . $interface . '.log';-// $level = 'debug';-// if ($app->bound('config')) {-// $level = $app->make('config')->get('app.log_level', 'debug');-// }-// $levels = [-// 'debug' => Logger::DEBUG,-// 'info' => Logger::INFO,-// 'notice' => Logger::NOTICE,-// 'warning' => Logger::WARNING,-// 'error' => Logger::ERROR,-// 'critical' => Logger::CRITICAL,-// 'alert' => Logger::ALERT,-// 'emergency' => Logger::EMERGENCY,-// ];-//-// $useLevel = $levels[$level];-//-// $formatter = new LineFormatter(null, null, true, true);-// $handler = new RotatingFileHandler($path, 5, $useLevel);-// $handler->setFormatter($formatter);-// $monolog->pushHandler($handler);-// }-// );-//}-/*|--------------------------------------------------------------------------| Return The Applicationdiff --git a/config/logging.php b/config/logging.phpnew file mode 100644index 0000000000..f8b2736cea--- /dev/null+++ b/config/logging.php@@ -0,0 +1,97 @@+<?php+/**+ * logging.php+ * Copyright (c) 2018 [email protected]+ *+ * This file is part of Firefly III.+ *+ * Firefly III is free software: you can redistribute it and/or modify+ * it under the terms of the GNU General Public License as published by+ * the Free Software Foundation, either version 3 of the License, or+ * (at your option) any later version.+ *+ * Firefly III is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.+ */++declare(strict_types=1);++return [++ /*+ |--------------------------------------------------------------------------+ | Default Log Channel+ |--------------------------------------------------------------------------+ |+ | This option defines the default log channel that gets used when writing+ | messages to the logs. The name specified in this option should match+ | one of the channels defined in the "channels" configuration array.+ |+ */++ 'default' => env('LOG_CHANNEL', 'daily'),++ /*+ |--------------------------------------------------------------------------+ | Log Channels+ |--------------------------------------------------------------------------+ |+ | Here you may configure the log channels for your application. Out of+ | the box, Laravel uses the Monolog PHP logging library. This gives+ | you a variety of powerful log handlers / formatters to utilize.+ |+ | Available Drivers: "single", "daily", "slack", "syslog",+ | "errorlog", "custom", "stack"+ |+ */++ 'channels' => [+ 'stack' => [+ 'driver' => 'stack',+ 'channels' => ['single'],+ ],++ 'single' => [+ 'driver' => 'single',+ 'path' => storage_path('logs/laravel.log'),+ 'level' => 'debug',+ ],++ 'daily' => [+ 'driver' => 'daily',+ 'path' => storage_path('logs/ff3-' . php_sapi_name() . '-.log'),+ 'level' => env('APP_LOG_LEVEL', 'info'),+ 'days' => 7,+ ],+ 'dailytest' => [+ 'driver' => 'daily',+ 'path' => storage_path('logs/test-ff3-' . php_sapi_name() . '-.log'),+ 'level' => env('APP_LOG_LEVEL', 'info'),+ 'days' => 7,+ ],++ 'slack' => [+ 'driver' => 'slack',+ 'url' => env('LOG_SLACK_WEBHOOK_URL'),+ 'username' => 'Laravel Log',+ 'emoji' => ':boom:',+ 'level' => 'critical',+ ],++ 'syslog' => [+ 'driver' => 'syslog',+ 'level' => env('APP_LOG_LEVEL', 'info'),+ ],++ 'errorlog' => [+ 'driver' => 'errorlog',+ 'level' => env('APP_LOG_LEVEL', 'info'),+ ],+ ],++];\ No newline at end of file