diff options
author | jonsmith1982 <you@example.com> | 2019-01-28 13:17:39 +0100 |
---|---|---|
committer | jonsmith1982 <jonsmith1982@googlemail.com> | 2019-01-28 14:12:12 +0100 |
commit | d14d85559266ab16b2261a10ab024276b3f3c226 (patch) | |
tree | d3e67fca4a01ea4c3dd341f0e370c384197f5420 | |
parent | 807f43b65d6b3fc35e8fed6fce1add36971f9f51 (diff) |
fixes #5648
Signed-off-by: jonsmith1982 <jonsmith1982@googlemail.com>
-rw-r--r-- | application/config/config.php | 11 | ||||
-rw-r--r-- | system/core/Log.php | 12 |
2 files changed, 22 insertions, 1 deletions
diff --git a/application/config/config.php b/application/config/config.php index 782b19c74..6710a4b88 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 d651e8abe..01407cfcf 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)) |