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
2. The ci-log4php directory has 2 folders. Copy and paste the ci_log4php folder in /application/third_party/
3. From the other folder Copy MY_Log.php file. Open config.php.
If $config['subclass_prefix'] = 'MY_';
then place the MY_Log.php file in /application/libraries/
4. Similarly Place the log4php.properties in /application/config folder and log4php_helper.php in /application/helpers folder
5. Edit the log4php.properties file. Set logs logs folder 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
7. Go inside the application folder and run > chmod -R 777 ./logs
8. Use these commands for logging -
// log_error('thiserror');
// log_info('thisinfo');
// log_debug('thisdebug');
No comments:
Post a Comment