From 166b8bf98d91377fd982d4c4902f5f26fecc8e29 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 24 Jan 2024 06:42:58 +0000 Subject: [PATCH 1/3] Use ONE Logfile instead of daily ones --- system/core/Log.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/core/Log.php b/system/core/Log.php index 36634c159..8b2b22ba5 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -184,7 +184,9 @@ class CI_Log { return FALSE; } - $filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext; + # Changed to ONE File (you could use Logrotate) instead of daily files # $filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext; + $config =& get_config(); + $filepath = $this->_log_path.'log-'.str_replace(array("http://","https://","/"),"",$config['base_url']).'.'.$this->_file_ext; $message = ''; if ( ! file_exists($filepath)) From b002dce73751f6c411146772261f0092ecee90fb Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 24 Jan 2024 07:05:56 +0000 Subject: [PATCH 2/3] Make Logtype (daily / one file) configurable --- system/core/Log.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/system/core/Log.php b/system/core/Log.php index 8b2b22ba5..7c722c496 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -184,9 +184,12 @@ class CI_Log { return FALSE; } - # Changed to ONE File (you could use Logrotate) instead of daily files # $filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext; $config =& get_config(); - $filepath = $this->_log_path.'log-'.str_replace(array("http://","https://","/"),"",$config['base_url']).'.'.$this->_file_ext; + if ((isset($config['one_log'])) && ($config['one_log'])) { + $filepath = $this->_log_path.'log-'.str_replace(array("http://","https://","/"),"",$config['base_url']).'.'.$this->_file_ext; + } else { + $filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext; + } $message = ''; if ( ! file_exists($filepath)) From 70e2278e1d44e875ce4cc5de5dc41488692ceb61 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 24 Jan 2024 07:06:19 +0000 Subject: [PATCH 3/3] Added Switch to sample-config --- application/config/config.sample.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/application/config/config.sample.php b/application/config/config.sample.php index 18c67e9c7..e3415191b 100644 --- a/application/config/config.sample.php +++ b/application/config/config.sample.php @@ -364,6 +364,19 @@ $config['log_threshold'] = 0; */ $config['log_path'] = ''; +/* +|-------------------------------------------------------------------------- +| One Logfile (true) or daily logfile? +|-------------------------------------------------------------------------- +| +| Leave this setted to false unless you would like to have one big logfile +| at application/logs/ directory. +| +| true == one big log +| false (or non-existant): daily logs +*/ +$config['one_log'] = false; + /* |-------------------------------------------------------------------------- | Log File Extension