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:
- Vscode setting console. Log () shortcut method
- Error [err] 1273 – unknown collation: ‘utf8mb4_ 0900_ ai_ ci‘
- Bad file descriptor(C:\ci\zeromq 1602704446950\work\src\epoll.cpp:100)
- PHP link database error PHP_ network_ getaddresses: getaddrinfo failed: Name or service not known
- PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[08004] [1040] Too many connections
- @In slf4j log.info Compile error: cannot find symbol log
- Consult IDE log for more details (Help | Show Log),read failed, socket might closed or timeout,
- After upgrading php7, PHP program prompts an error: operator not supported for strings in causes and Solutions
- Apache [error] server reached MaxClients setting, consider raising the MaxClients setting
- php open(/var/lib/php/session/sess_4ofxxx, O_RDWR) failed: Permission denied (13)
- Error lnk2038: detected “0”_ ITERATOR_ DEBUG_ The reason and solution of the unmatched item of “level”
- Nginx error log (error_ Log) configuration and information explanation
- PHP – PHP Error[2]: Error while sending QUERY packet. PID=*
- Ubuntu18.04 x11vnc failed, report error opening logfile: /var/log/x11vnc.log
- SQL Msg 18054, Level 16, State 1
- Eclipse startup error: an error has occurred.See the log file E:\workspace\.metadata\.log.
- Change API level Android studio
- Eclipse Syntax error, annotations are only available if source level is 1.5 or greater
- Cannot call the same level library solution in pychar