A log file is created each time the page runs which are controlled by the developer. log_message() writes the messages in log file.
Syntax
log_message('level','message');
-> level
represents error message type that is desired to log. Three levels of error message exists:
debug, error and info.
-> message
parameter shows the error in the form of string.
Eg:
[php]log_message('error','username is empty');[/php]
Message types in detail are:
Error messages: Error messages are the actual errors that are similar to PHP errors or user errors.
Debug messages: Debug messages helps while debugging the code.
Information messages: These messages gives an information about some process which are not given much priority. CodeIgniter cannot generate information messages on its own.
Log_threshold configuration has the entire control to allow an error to log. The logging threshold is present as
$config[‘log_threshold’]
in
application/config/config.php. To log to any error message, set the value of $config['log_threshold'] to 1 according to the commented information given in the config.php file about it. By default it is set to 0 (zero) as shown below:
[php]$config['log_threshold'] = 0;[/php]
Error logging is turned off if the value is set to zero.