duartix Posted November 14, 2013 Share Posted November 14, 2013 (edited) I'm using PHP 5.5.1 and CodeIgniter 2.1.4- On one of my controllers, I've got the following code: public function logout() { error_log("LOGOUT!"); } The problem is that this "LOGOUT!" message never appears in my log file: C:\xampp\htdocs\glup2\application\logs\log-2013-11-14.php I've tried raising the error log threshold, but it's not working. My config.php is as follows: $config['log_threshold'] = 4; $config['log_path'] = ''; $config['log_date_format'] = 'Y-m-d H:i:s'; All sorts of debug messages (like class loading and helper loads) get to the log, but not my LOGOUT message. Any ideas on what I'm doing wrong? TIA. Edited November 14, 2013 by duartix Quote Link to comment https://forums.phpfreaks.com/topic/283891-cant-seem-to-write-to-log/ Share on other sites More sharing options...
Ch0cu3r Posted November 14, 2013 Share Posted November 14, 2013 The log_path is set to nothing $config['log_path'] = ''; How does error_log() know to write to the log file located in C:\xampp\htdocs\glup2\application\logs error_log is not a native PHP or CodeIgniter function. Is this your own custom function? If its maybe post the source code here. Quote Link to comment https://forums.phpfreaks.com/topic/283891-cant-seem-to-write-to-log/#findComment-1458242 Share on other sites More sharing options...
duartix Posted November 14, 2013 Author Share Posted November 14, 2013 (edited) I thought it was native: http://php.net/manual/en/function.error-log.php There is a comment section in config.php just before that attribution, that goes like this: /* |-------------------------------------------------------------------------- | Error Logging Directory Path |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default | application/logs/ folder. Use a full server path with trailing slash. | */ $config['log_path'] = ''; I just omitted it for the sake of readability. However I doubt the problem is with that, as it is writing the log file wherever I set it to write to. Edited November 14, 2013 by duartix Quote Link to comment https://forums.phpfreaks.com/topic/283891-cant-seem-to-write-to-log/#findComment-1458249 Share on other sites More sharing options...
Solution duartix Posted November 14, 2013 Author Solution Share Posted November 14, 2013 (edited) Solved. Switched from error_log (PHP) to log_message (CodeIgniter). It's working.Thanks for the lead! Edited November 14, 2013 by duartix Quote Link to comment https://forums.phpfreaks.com/topic/283891-cant-seem-to-write-to-log/#findComment-1458250 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.