diff --git a/config-templates/config.php b/config-templates/config.php index 8682dafd8b443ac5de5f506a58e726ed81af4460..740a833ffca5246563a694f91ea5b1c306039ca9 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -56,7 +56,8 @@ $config = [ /* * The following settings are *filesystem paths* which define where * SimpleSAMLphp can find or write the following things: - * - 'loggingdir': Where to write logs. + * - 'loggingdir': Where to write logs. MUST be set to NULL when using a logging + * handler other than `file`. * - 'datadir': Storage of general data. * - 'tempdir': Saving temporary files. SimpleSAMLphp will attempt to create * this directory if it doesn't exist. @@ -323,7 +324,6 @@ $config = [ */ - /************************** | LOGGING AND STATISTICS | **************************/ @@ -359,7 +359,7 @@ $config = [ * * - %level: the log level (name or number depending on the handler used). * - * - %stat: if the log entry is intended for statistical purposes, it will print the string 'STAT ' (bear in mind +- * - %stat: if the log entry is intended for statistical purposes, it will print the string 'STAT ' (bear in mind * the trailing space). * * - %trackid: the track ID, an identifier that allows you to track a single session. diff --git a/src/SimpleSAML/Kernel.php b/src/SimpleSAML/Kernel.php index 90dd4099dc3a463aa6287edc5b50898000578a32..0f25585fd535a24b3cd5c6a86118bd556980bb48 100644 --- a/src/SimpleSAML/Kernel.php +++ b/src/SimpleSAML/Kernel.php @@ -16,6 +16,10 @@ use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; +use function getenv; +use function is_dir; +use function sys_get_temp_dir; + /** * A class to create the container and handle a given request. */ @@ -67,12 +71,7 @@ class Kernel extends BaseKernel { $configuration = Configuration::getInstance(); $handler = $configuration->getString('logging.handler'); - - if ($handler === 'file') { - $loggingPath = $configuration->getString('loggingdir'); - } else { - $loggingPath = '/dev/null'; - } + $loggingPath = $configuration->getString('loggingdir', sys_get_temp_dir()); $sysUtils = new System(); if ($sysUtils->isAbsolutePath($loggingPath)) {