当前位置:网站首页>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.');
边栏推荐
- MongoDB 的安装和基本操作
- Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (III)
- 0214-27100 a day with little fluctuation
- Uploads labs range (with source code analysis) (under update)
- Advanced Mathematics (Seventh Edition) Tongji University exercises 2-1 personal solutions
- TCP擁塞控制詳解 | 3. 設計空間
- June to - -------
- 2022年Q2加密市场投融资报告:GameFi成为投资关键词
- Redis installation under windows and Linux systems
- How can technology managers quickly improve leadership?
猜你喜欢

Break through 1million, sword finger 2million!

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

Remote file contains actual operation

Redis installation under windows and Linux systems

One article takes you to understand machine learning

近视:摘镜or配镜?这些问题必须先了解清楚

Q2 encryption market investment and financing report in 2022: gamefi becomes an investment keyword

Mb10m-asemi rectifier bridge mb10m

探索Cassandra的去中心化分布式架构

Low level version of drawing interface (explain each step in detail)
随机推荐
[combinatorics] summary of combinatorial identities (eleven combinatorial identities | proof methods of combinatorial identities | summation methods)*
ThreeJS 第二篇:顶点概念、几何体结构
The mixlab editing team is recruiting teammates~~
远程文件包含实操
Three dimensional reconstruction of deep learning
Mb10m-asemi rectifier bridge mb10m
Pointcut expression
Q2 encryption market investment and financing report in 2022: gamefi becomes an investment keyword
MB10M-ASEMI整流桥MB10M
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)
【Proteus仿真】8×8LED点阵屏仿电梯数字滚动显示
[web security] - [SQL injection] - error detection injection
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
Effect of ARP package on FTP dump under vxworks-6.6 system
PHP二级域名session共享方案
From "zero sum game" to "positive sum game", PAAS triggered the third wave of cloud computing
Unity project optimization case 1
Expression of request header in different countries and languages
[list to map] collectors Tomap syntax sharing (case practice)
[redis foundation] understand redis persistence mechanism together (rdb+aof graphic explanation)