当前位置:网站首页>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.');
边栏推荐
- Explore Cassandra's decentralized distributed architecture
- [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
- Record a jar package conflict resolution process
- TCP擁塞控制詳解 | 3. 設計空間
- Everyone in remote office works together to realize cooperative editing of materials and development of documents | community essay solicitation
- 用同花顺炒股开户安全吗?
- [combinatorics] summary of combinatorial identities (eleven combinatorial identities | proof methods of combinatorial identities | summation methods)*
- Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
- "Remake Apple product UI with Android" (3) - elegant statistical chart
- Chinese translation of Tagore's floating birds (1~10)
猜你喜欢
8个酷炫可视化图表,快速写出老板爱看的可视化分析报告
嵌入式开发:避免开源软件的7个理由
[solved] access denied for user 'root' @ 'localhost' (using password: yes)
Principles of several common IO models
Break through 1million, sword finger 2million!
[statement] about searching sogk1997 and finding many web crawler results
Stm32f103c8t6 firmware library lighting
About text selection in web pages and counting the length of selected text
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
随机推荐
Client does not support authentication protocol requested by server; consider upgrading MySQL client
【Proteus仿真】8×8LED点阵屏仿电梯数字滚动显示
Extraction of the same pointcut
[combinatorics] combinatorial identity (sum of variable upper terms 1 combinatorial identity | summary of three combinatorial identity proof methods | proof of sum of variable upper terms 1 combinator
Detailed explanation of four modes of distributed transaction (Seata)
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
Golang 装饰器模式以及在NSQ中的使用
Three dimensional reconstruction of deep learning
MongoDB 的安装和基本操作
Explore Netease's large-scale automated testing solutions see here see here
Pyinstaller is not an internal or external command, nor is it a runnable program or batch file
The accept attribute of the El upload upload component restricts the file type (detailed explanation of the case)
Expression of request header in different countries and languages
Page dynamics [2]keyframes
Redis installation under windows and Linux systems
pycharm错Error updating package list: connect timed out
How to initialize views when loading through storyboards- How is view initialized when loaded via a storyboard?
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (II)
Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
Multithread 02 thread join