No BS, the steps are as following -
1. Clone the github project at https://github.com/fukata/ci-log4php
>: git clone https://github.com/fukata/ci-log4php.git
5. Edit the log4php.properties file. Set logs logs folder path (If you are using different environment folders for development, production and testing, it would be best to place a different log4php.properties file in each one of them so that while deploying you will not have to change the path)
log4php.appender.default.file = /path/to/ci-app/application/logs/%s.log
6. Set the $config['log_threshold'] = 4; in config.php according to :
- | 0 = Disables logging, Error logging TURNED OFF
- | 1 = Error Messages (including PHP errors)
- | 2 = Debug Messages
- | 3 = Informational Messages
- | 4 = All Messages
Though I must add that level 4 prints too much log, so in production you might want to keep it to level 1 else your logs will pile up needlessly.
7. Go inside the application folder and run >
chmod -R 777 ./logs
8. Use these commands for logging -
$this->load->helper(‘log4php’);
log_error(‘my_error’);
log_info(‘my_info’);
log_debug(‘my_debug’);

[...] 7. Setup logging – Use third party library ci_log4php Refer my blogpost here [...]