当前位置:网站首页>PHP CI (CodeIgniter) log level setting
PHP CI (CodeIgniter) log level setting
2022-07-03 16:20:00 【Brother Xing plays with the clouds】
1、Ci The error level of is generally set at index.php in , You can set ENVIRONMENT. In general , When developing, choose development Pattern , After the official release , choice production Pattern .
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 By default, the error log of is stored in application/logs/log-[time].php in , Level of logging 、 route 、 Time format, etc , stay application/config/config.php Set in file , The relevant 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、 When you need to log when writing code yourself , You can call global functions log_message(' Level ',' news '), The parameter of level is ( debugging debug, error error, Information info), You can define the content yourself .
log_message('error', 'error message.'); log_message('debug', 'debug message.'); log_message('info', 'info message.');
边栏推荐
- uploads-labs靶场(附源码分析)(更新中)
- Page dynamics [2]keyframes
- Cocos Creator 2.x 自动打包(构建 + 编译)
- QT串口ui设计和解决显示中文乱码
- The accept attribute of the El upload upload component restricts the file type (detailed explanation of the case)
- Go language self-study series | if else if statement in golang
- Rk3399 platform development series explanation (WiFi) 5.54. What is WiFi wireless LAN
- [web security] - [SQL injection] - error detection injection
- Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)
- June to - -------
猜你喜欢

ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装

0214-27100 a day with little fluctuation

Explore Cassandra's decentralized distributed architecture

【Proteus仿真】74HC595+74LS154驱动显示16X16点阵

Semi supervised learning

Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)

Myopia: take off or match glasses? These problems must be understood clearly first

Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day

Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (III)

Deep understanding of grouping sets statements in SQL
随机推荐
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
How to thicken the brush in the graphical interface
Three dimensional reconstruction of deep learning
手机注册股票开户安全吗 开户需要钱吗
The difference between calling by value and simulating calling by reference
Rk3399 platform development series explanation (WiFi) 5.54. What is WiFi wireless LAN
特征多项式与常系数齐次线性递推
Redis installation under windows and Linux systems
首发!!lancet饿了么官方文档
Client does not support authentication protocol requested by server; consider upgrading MySQL client
14 topics for performance interviews between superiors and subordinates (4)
用同花顺炒股开户安全吗?
Pandora IOT development board learning (HAL Library) - Experiment 5 external interrupt experiment (learning notes)
[combinatorics] combinatorial identities (review of eight combinatorial identities | product of combinatorial identities 1 | proof | use scenario | general method for finding combinatorial numbers)
Multithread 02 thread join
pyinstaller不是内部或外部命令,也不是可运行的程序 或批处理文件
Advanced Mathematics (Seventh Edition) Tongji University exercises 2-1 personal solutions
相同切入点的抽取
Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
The accept attribute of the El upload upload component restricts the file type (detailed explanation of the case)