summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2022-01-05 20:10:18 +0100
committerGitHub <noreply@github.com>2022-01-05 20:10:18 +0100
commitfbc1b4d228f0cd84b07bec08ed030708304e661d (patch)
tree6e17ae367679101ae65196d4079ac6f6d8e997b2
parent3e6ade949817821c29a1e5fc3b512320b5de7843 (diff)
parentd14d85559266ab16b2261a10ab024276b3f3c226 (diff)
Merge pull request #5684 from jonsmith1982/develop
partially fixes #5648
-rw-r--r--application/config/config.php11
-rw-r--r--system/core/Log.php12
2 files changed, 22 insertions, 1 deletions
diff --git a/application/config/config.php b/application/config/config.php
index 3d9cced63..83d8802fb 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -228,6 +228,17 @@ $config['log_path'] = '';
/*
|--------------------------------------------------------------------------
+| Error Logging FILENAME
+|--------------------------------------------------------------------------
+|
+| Leave this BLANK unless you would like to set something other than the default
+| 'log-'.date('Y-m-d') filename. No DIRECTORY_SEPARATOR(s) or file extension
+|
+*/
+$config['log_file'] = '';
+
+/*
+|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
diff --git a/system/core/Log.php b/system/core/Log.php
index 9c33f3e98..8ce1b83a2 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -54,6 +54,13 @@ class CI_Log {
* @var string
*/
protected $_log_path;
+
+ /**
+ * Filename of log
+ *
+ * @var string
+ */
+ protected $_log_file;
/**
* File permissions
@@ -127,6 +134,9 @@ class CI_Log {
$this->_log_path = ($config['log_path'] !== '')
? rtrim($config['log_path'], '/\\').DIRECTORY_SEPARATOR : APPPATH.'logs'.DIRECTORY_SEPARATOR;
+ $this->_log_file = (isset($config['log_file']) && $config['log_file'] !== '')
+ ? $config['log_file'] : 'log-'.date('Y-m-d');
+
$this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '')
? ltrim($config['log_file_extension'], '.') : 'php';
@@ -184,7 +194,7 @@ class CI_Log {
return FALSE;
}
- $filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext;
+ $filepath = $this->_log_path.$this->_log_file.'.'.$this->_file_ext;
$message = '';
if ( ! file_exists($filepath))