Jump to content

Can't seem to write to LOG...


duartix

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/283891-cant-seem-to-write-to-log/
Share on other sites

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.

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. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.