From 132a807dff7fc2d173e2e3bebb18ee181c7b27d9 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 28 Dec 2015 08:47:37 +0100 Subject: [PATCH 1/3] add .log suffix to all log file names --- program/lib/Roundcube/rcube.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 3694c5c4b..ef5dcb94e 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -1246,7 +1246,7 @@ class rcube $log_dir = RCUBE_INSTALL_PATH . 'logs'; } - return file_put_contents("$log_dir/$name", $line, FILE_APPEND) !== false; + return file_put_contents("$log_dir/$name.log", $line, FILE_APPEND) !== false; } /** From 6ca4eab399adad22ed93b26c5870896425631dfa Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 27 Jun 2017 13:35:01 +0200 Subject: [PATCH 2/3] add 'log_file_ext' configuration option --- config/defaults.inc.php | 3 +++ program/lib/Roundcube/rcube.php | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/defaults.inc.php b/config/defaults.inc.php index e2db2b726..050803231 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -77,6 +77,9 @@ $config['log_date_format'] = 'd-M-Y H:i:s O'; // set to 0 to avoid session IDs being logged. $config['log_session_id'] = 8; +// Default extension used for log file name +$config['log_file_ext'] = '.log'; + // Syslog ident string to use, if using the 'syslog' log driver. $config['syslog_id'] = 'roundcube'; diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index ef5dcb94e..401cd3f86 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -1242,11 +1242,17 @@ class rcube } } + if (self::$instance) { + $log_suf = self::$instance->config->get('log_file_ext', '.log'); + } else { + $log_suf = '.log'; + } + if (empty($log_dir)) { $log_dir = RCUBE_INSTALL_PATH . 'logs'; } - return file_put_contents("$log_dir/$name.log", $line, FILE_APPEND) !== false; + return file_put_contents("$log_dir/$name$log_suf", $line, FILE_APPEND) !== false; } /** From a8278d61cff0d426ee1b3f3a3598111eac1cdef9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 30 Jun 2017 09:59:56 +0200 Subject: [PATCH 3/3] Update changelog, CS fixes --- CHANGELOG | 1 + program/lib/Roundcube/rcube.php | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0e632743c..763e0ad87 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Add .log suffix to all log file names, add option log_file_ext to control this (#313) - Archive: Fix archiving by sender address on cyrus-imap - Archive: Add Thunderbird compatible Month option (#5623) - Return "401 Unauthorized" status when login fails (#5663) diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 9317ef4d4..2e1366d23 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -1250,17 +1250,18 @@ class rcube } } - if (self::$instance) { - $log_suf = self::$instance->config->get('log_file_ext', '.log'); - } else { - $log_suf = '.log'; - } - if (empty($log_dir)) { $log_dir = RCUBE_INSTALL_PATH . 'logs'; } - return file_put_contents("$log_dir/$name$log_suf", $line, FILE_APPEND) !== false; + if (self::$instance) { + $name .= self::$instance->config->get('log_file_ext', '.log'); + } + else { + $name .= '.log'; + } + + return file_put_contents("$log_dir/$name", $line, FILE_APPEND) !== false; } /**