当前位置:网站首页>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.');
边栏推荐
- Basis of target detection (IOU)
- Extraction of the same pointcut
- 深入理解 SQL 中的 Grouping Sets 语句
- Qt插件之自定义插件构建和使用
- The mixlab editing team is recruiting teammates~~
- Go language self-study series | golang switch statement
- Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
- PHP中register_globals参数设置
- [combinatorics] non descending path problem (outline of non descending path problem | basic model of non descending path problem | non descending path problem expansion model 1 non origin starting poi
- pyinstaller不是内部或外部命令,也不是可运行的程序 或批处理文件
猜你喜欢
From the 18th line to the first line, the new story of the network security industry
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (II)
[list to map] collectors Tomap syntax sharing (case practice)
Record windows10 installation tensorflow-gpu2.4.0
嵌入式开发:避免开源软件的7个理由
"Remake Apple product UI with Android" (2) -- silky Appstore card transition animation
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装
探索Cassandra的去中心化分布式架构
TCP擁塞控制詳解 | 3. 設計空間
随机推荐
Interviewer: how does the JVM allocate and recycle off heap memory
[combinatorics] combinatorial identities (sum of variable terms 3 combinatorial identities | sum of variable terms 4 combinatorial identities | binomial theorem + derivation to prove combinatorial ide
[list to map] collectors Tomap syntax sharing (case practice)
Redis high availability and persistence
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (II)
Reflection on some things
Colab works with Google cloud disk
PHP二级域名session共享方案
Break through 1million, sword finger 2million!
跟我学企业级flutter项目:简化框架demo参考
"Remake Apple product UI with Android" (2) -- silky Appstore card transition animation
14 topics for performance interviews between superiors and subordinates (4)
Advanced Mathematics (Seventh Edition) Tongji University exercises 2-1 personal solutions
初试scikit-learn库
LeetCode1491. Average value of wages after removing the minimum wage and the maximum wage
8个酷炫可视化图表,快速写出老板爱看的可视化分析报告
0214-27100 a day with little fluctuation
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
Three dimensional reconstruction of deep learning
PHP CI(CodeIgniter)log级别设置