1, Ci error level setting is generally in index. PHP, you can set the ENVIRONMENT. Generally speaking, development mode is selected when developing, and production mode is selected after the official release. The code is as follows:
/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
* You can load different configurations depending on your
* current environment. Setting the environment also influences
* things like logging and error reporting.
*
* This can be set to anything, but default usage is:
*
* development
* testing
* production
*
* NOTE: If you change these, also change the error_reporting() code below
*
*/
define('ENVIRONMENT', 'development');
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
2, CI error log by default in the application/logs/log – [time]. PHP, log level, path, time format, etc., in the application/config/config. The PHP file Settings, the code is as follows:
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
/*
|--------------------------------------------------------------------------
| 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'] = '';
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
3, in their own code to log, you can call the global function log_message(‘ level ‘,’ message ‘), the level of parameters is (debug Debug, error error, information info), the content can be defined by themselves.
log_message('error', 'error message.');
log_message('debug', 'debug message.');
log_message('info', 'info message.');
Read More:
- HTTP Error 502.5 – Process Failure (How to Fix)
- Tomcat error: error parsing HTTP request header
- Tomcat start error: severe: error listener start
- Error lnk2038: detected “0”_ ITERATOR_ DEBUG_ The reason and solution of the unmatched item of “level”
- Solution to Tomcat starting error listener start
- Springboot print SQL log
- net core HTTP Error 502.5 – ANCM Out-Of-Process Startup Failure
- Unity Android packaging error “UnityEditor.BuildPlayerWindow+BuildMethodException” solution record
- About error statuslogger no log4j2 configuration file found
- IntelliJ idea solves Tomcat error: error listener start
- Attributeerror: ‘module’ object has no attribute ‘handlers’ — Python sub module import problem
- “%Error opening tftp://255.255.255.255/network config”
- Error: pg_config executable not found.
- 【ORA】Error 1031 received logging on to the standby
- Putty prompt network error: software caused connection abort solution
- Resolve the problem of “event ID 4107” or “event ID 11” errors recorded in the application logs of windows and windows server
- Node configuration environment variable and global installation of webapck
- QuickFIX/J100% Java Open Source FIX Engine
- [tools] vscode debug report G + +. Exe no such file or directory fatal error no input files
- Java learning error information 3 — Java notes