From 0bd6b28045c9b9a820e580b3f651f474b60348a3 Mon Sep 17 00:00:00 2001 From: Chris Passas Date: Wed, 13 Feb 2013 14:16:18 -0500 Subject: Added support for changing the default log file extension from .php to whatever is preferred. example (.log) This is a follow up to this pull request. https://github.com/EllisLab/CodeIgniter/pull/2243 --- application/config/config.php | 11 +++++++++++ system/core/Log.php | 2 ++ user_guide_src/source/changelog.rst | 1 + 3 files changed, 14 insertions(+) diff --git a/application/config/config.php b/application/config/config.php index 415474e06..6f597b1e2 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -224,6 +224,17 @@ $config['log_threshold'] = 0; */ $config['log_path'] = ''; +/* +|-------------------------------------------------------------------------- +| Log File Extension +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| 'php'. For example you could change it to 'log'. +| +*/ +$config['log_file_extension'] = ''; + /* |-------------------------------------------------------------------------- | Date Format for Logs diff --git a/system/core/Log.php b/system/core/Log.php index 3b0a9213d..7572d2ac6 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -104,6 +104,8 @@ class CI_Log { $this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/'; + $this->_log_ext = ($config['log_file_extension'] !== '') ? $config['log_file_extension'] : $this->_log_ext; + file_exists($this->_log_path) OR mkdir($this->_log_path, DIR_WRITE_MODE, TRUE); if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path)) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 893c3db61..7f12ca8a1 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -55,6 +55,7 @@ Release Date: Not Released - Updated *ip_address* database field lengths from 16 to 45 for supporting IPv6 address on :doc:`Trackback Library ` and :doc:`Captcha Helper `. - Removed *cheatsheets* and *quick_reference* PDFs from the documentation. - Added availability checks where usage of dangerous functions like ``eval()`` and ``exec()`` is required. + - Added support for changing the file extension of CodeIgniter log files using $config['log_file_extension']. - Helpers -- cgit v1.2.3-24-g4f1b