summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.docker/php/php-fpm.conf3
-rw-r--r--app/ServiceProvider/LoggingProvider.php29
-rw-r--r--app/constants.php12
-rw-r--r--composer.json2
-rw-r--r--composer.lock14
-rw-r--r--config.default.php10
-rw-r--r--doc/config.markdown30
-rw-r--r--doc/env.markdown5
8 files changed, 60 insertions, 45 deletions
diff --git a/.docker/php/php-fpm.conf b/.docker/php/php-fpm.conf
index 5d84c2ae..c51c2212 100644
--- a/.docker/php/php-fpm.conf
+++ b/.docker/php/php-fpm.conf
@@ -6,8 +6,7 @@ daemonize = no
[www]
env[DATABASE_URL] = $DATABASE_URL
env[DEBUG] = $DEBUG
-env[DEBUG_FILE] = $DEBUG_FILE
-env[ENABLE_SYSLOG] = $ENABLE_SYSLOG
+env[LOG_DRIVER] = stderr
catch_workers_output = yes
user = nginx
diff --git a/app/ServiceProvider/LoggingProvider.php b/app/ServiceProvider/LoggingProvider.php
index 68c074f0..4d6adbe4 100644
--- a/app/ServiceProvider/LoggingProvider.php
+++ b/app/ServiceProvider/LoggingProvider.php
@@ -6,6 +6,8 @@ use Psr\Log\LogLevel;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use SimpleLogger\Logger;
+use SimpleLogger\Stderr;
+use SimpleLogger\Stdout;
use SimpleLogger\Syslog;
use SimpleLogger\File;
@@ -14,19 +16,32 @@ class LoggingProvider implements ServiceProviderInterface
public function register(Container $container)
{
$logger = new Logger;
+ $driver = null;
- if (ENABLE_SYSLOG) {
- $syslog = new Syslog('kanboard');
- $syslog->setLevel(LogLevel::ERROR);
- $logger->setLogger($syslog);
+ switch (LOG_DRIVER) {
+ case 'syslog':
+ $driver = new Syslog('kanboard');
+ break;
+ case 'stdout':
+ $driver = new Stdout();
+ break;
+ case 'stderr':
+ $driver = new Stderr();
+ break;
+ case 'file':
+ $driver = new File(LOG_FILE);
+ break;
}
- if (DEBUG) {
- $logger->setLogger(new File(DEBUG_FILE));
+ if ($driver !== null) {
+ if (! DEBUG) {
+ $driver->setLevel(LogLevel::INFO);
+ }
+
+ $logger->setLogger($driver);
}
$container['logger'] = $logger;
-
return $container;
}
}
diff --git a/app/constants.php b/app/constants.php
index b5b01960..6f30af7f 100644
--- a/app/constants.php
+++ b/app/constants.php
@@ -16,8 +16,13 @@ defined('FILES_DIR') or define('FILES_DIR', DATA_DIR.DIRECTORY_SEPARATOR.'files'
defined('PLUGINS_DIR') or define('PLUGINS_DIR', ROOT_DIR.DIRECTORY_SEPARATOR.'plugins');
// Enable/disable debug
-defined('DEBUG') or define('DEBUG', getenv('DEBUG'));
-defined('DEBUG_FILE') or define('DEBUG_FILE', getenv('DEBUG_FILE') ?: DATA_DIR.DIRECTORY_SEPARATOR.'debug.log');
+defined('DEBUG') or define('DEBUG', strtolower(getenv('DEBUG')) === 'true');
+
+// Logging drivers: syslog, stdout, stderr or file
+defined('LOG_DRIVER') or define('LOG_DRIVER', getenv('LOG_DRIVER'));
+
+// Logging file
+defined('LOG_FILE') or define('LOG_FILE', DATA_DIR.DIRECTORY_SEPARATOR.'debug.log');
// Application version
defined('APP_VERSION') or define('APP_VERSION', build_app_version('$Format:%d$', '$Format:%H$'));
@@ -96,9 +101,6 @@ defined('ENABLE_HSTS') or define('ENABLE_HSTS', true);
// Enable or disable "X-Frame-Options: DENY" HTTP header
defined('ENABLE_XFRAME') or define('ENABLE_XFRAME', true);
-// Syslog
-defined('ENABLE_SYSLOG') or define('ENABLE_SYSLOG', getenv('ENABLE_SYSLOG'));
-
// Escape html inside markdown text
defined('MARKDOWN_ESCAPE_HTML') or define('MARKDOWN_ESCAPE_HTML', true);
diff --git a/composer.json b/composer.json
index 6ac627a1..768bb97a 100644
--- a/composer.json
+++ b/composer.json
@@ -28,7 +28,7 @@
"erusev/parsedown" : "1.6.0",
"fguillot/json-rpc" : "1.1.0",
"fguillot/picodb" : "1.0.10",
- "fguillot/simpleLogger" : "1.0.0",
+ "fguillot/simpleLogger" : "1.0.1",
"fguillot/simple-validator" : "1.0.0",
"paragonie/random_compat": "@stable",
"pimple/pimple" : "~3.0",
diff --git a/composer.lock b/composer.lock
index c250a227..0fd26371 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "d3e42867a9978b7e3f2dbf0861e73519",
- "content-hash": "3f031c0bd8d109e424d67a4d59cde8e3",
+ "hash": "82919780935641d67b876686f590fef1",
+ "content-hash": "9f74907d3c4ec204ff714821eecd75f9",
"packages": [
{
"name": "christian-riesen/base32",
@@ -312,16 +312,16 @@
},
{
"name": "fguillot/simpleLogger",
- "version": "v1.0.0",
+ "version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/fguillot/simpleLogger.git",
- "reference": "f9f46439219749a67cefe0983286d540739ba973"
+ "reference": "c6831841193bb265b7900ecc8b6a8918371a7c98"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fguillot/simpleLogger/zipball/f9f46439219749a67cefe0983286d540739ba973",
- "reference": "f9f46439219749a67cefe0983286d540739ba973",
+ "url": "https://api.github.com/repos/fguillot/simpleLogger/zipball/c6831841193bb265b7900ecc8b6a8918371a7c98",
+ "reference": "c6831841193bb265b7900ecc8b6a8918371a7c98",
"shasum": ""
},
"require": {
@@ -345,7 +345,7 @@
],
"description": "PHP library to write logs (compatible with PSR-3)",
"homepage": "https://github.com/fguillot/simpleLogger",
- "time": "2015-08-29 14:44:37"
+ "time": "2016-05-07 18:01:57"
},
{
"name": "gregwar/captcha",
diff --git a/config.default.php b/config.default.php
index 8e5c6e49..abc928a9 100644
--- a/config.default.php
+++ b/config.default.php
@@ -7,8 +7,11 @@
// Enable/Disable debug
define('DEBUG', false);
-// Debug file path
-define('DEBUG_FILE', __DIR__.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'debug.log');
+// Available log drivers: syslog, stderr, stdout or file
+define('LOG_DRIVER', '');
+
+// Log filename if the log driver is "file"
+define('LOG_FILE', __DIR__.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'debug.log');
// Plugins directory
define('PLUGINS_DIR', 'plugins');
@@ -168,9 +171,6 @@ define('ENABLE_HSTS', true);
// Enable or disable "X-Frame-Options: DENY" HTTP header
define('ENABLE_XFRAME', true);
-// Enable syslog logging
-define('ENABLE_SYSLOG', true);
-
// Escape html inside markdown text
define('MARKDOWN_ESCAPE_HTML', true);
diff --git a/doc/config.markdown b/doc/config.markdown
index 2f88d306..a8df887f 100644
--- a/doc/config.markdown
+++ b/doc/config.markdown
@@ -8,21 +8,13 @@ Enable/Disable debug mode
-------------------------
```php
-define('DEBUG', false);
+define('DEBUG', true);
+define('LOG_DRIVER', 'file'); // Other drivers are: syslog, stdout, stderr or file
```
+The log driver must be defined if you enable the debug mode.
The debug mode logs all SQL queries and the time taken to generate pages.
-Debug file path
----------------
-
-```php
-define('DEBUG_FILE', __DIR__.'/data/debug.log');
-```
-
-All debug information are saved in this file.
-If you prefer to send logs to `stdout` or `stderr` replace the value by `php://stdout` or `php://stderr`.
-
Plugins folder
--------------
@@ -157,6 +149,9 @@ define('LDAP_USER_ATTRIBUTE_EMAIL', 'mail');
// LDAP attribute to find groups in user profile
define('LDAP_USER_ATTRIBUTE_GROUPS', 'memberof');
+// LDAP attribute for user avatar image: thumbnailPhoto or jpegPhoto
+define('LDAP_USER_ATTRIBUTE_PHOTO', '');
+
// Allow automatic LDAP user creation
define('LDAP_USER_CREATION', true);
@@ -227,13 +222,18 @@ define('ENABLE_XFRAME', true);
Logging
-------
+By default, Kanboard do not log anything.
+If you want to enable the logging, you have to set a log driver.
+
```php
-// Enable syslog logging
-// Set to false to disable syslog
-define('ENABLE_SYSLOG', true);
+// Available log drivers: syslog, stderr, stdout or file
+define('LOG_DRIVER', '');
+
+// Log filename if the log driver is "file"
+define('LOG_FILE', __DIR__.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'debug.log');
```
-Bruteforce protection
+Brute-force protection
---------------------
```php
diff --git a/doc/env.markdown b/doc/env.markdown
index a01d0a6f..28f14b18 100644
--- a/doc/env.markdown
+++ b/doc/env.markdown
@@ -6,6 +6,5 @@ Environment variables maybe useful when Kanboard is deployed as container (Docke
| Variable | Description |
|---------------|---------------------------------------------------------------------------------------------------------------------------------|
| DATABASE_URL | `[database type]://[username]:[password]@[host]:[port]/[database name]`, example: `postgres://foo:foo@myserver:5432/kanboard` |
-| DEBUG | Enable/Disable debug mode |
-| DEBUG_FILE | Debug file location, `DEBUG_FILE=php://stderr` |
-| ENABLE_SYSLOG | Enable/Disable logging to Syslog: `ENABLE_SYSLOG=1` |
+| DEBUG | Enable/Disable debug mode: "true" or "false" |
+| LOG_DRIVER | Logging driver: stdout, stderr, file or syslog |