当前位置:网站首页>CodeIgniter 打开错误日志
CodeIgniter 打开错误日志
2022-07-31 13:17:00 【fareast_mzh】
app/config/config.php
/*
|--------------------------------------------------------------------------
| 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'] = 4;
默认0 不输出log, 4等级最高
app/logs/log-2022-07-29.php
输出日志用\log_message函数
log_message('error', "Unable to write cache file: ".$cache_path);
system/core/Common.php
system/libraries/Log.php
/**
* Write Log File
*
* Generally this function will be called using the global log_message() function
*
* @param string the error level
* @param string the error message
* @param bool whether the error is a native PHP error
* @return bool
*/
public function write_log($level = 'error', $msg, $php_error = FALSE)
{
if ($this->_enabled === FALSE)
{
return FALSE;
}
$level = strtoupper($level);
if ( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold))
{
return FALSE;
}
$filepath = $this->_log_path.'log-'.date('Y-m-d').'.php';
$message = '';
if ( ! file_exists($filepath))
{
$message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n";
}
if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE))
{
return FALSE;
}
$message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt). ' --> '.$msg."\n";
flock($fp, LOCK_EX);
fwrite($fp, $message);
flock($fp, LOCK_UN);
fclose($fp);
@chmod($filepath, FILE_WRITE_MODE);
return TRUE;
}
CodeIgniter phpstorm自动补全
@property \CI_Input input
<?php
/**
* @property \MY_Loader load
* @property \CI_Input input
*/
class Common extends CI_Controller {
// ...
}
边栏推荐
- Error IDEA Terminated with exit code 1
- 使用openssl命令生成证书和对应的私钥,私钥签名,公钥验签
- Selenium自动化测试之Selenium IDE
- TensorRT安装及使用教程「建议收藏」
- 如何使用StarUML画类图[通俗易懂]
- ECCV2022: Recursion on Transformer without adding parameters and less computation!
- 生产力工具和插件
- ICML2022 | Fully Granular Self-Semantic Propagation for Self-Supervised Graph Representation Learning
- IDEA连接MySQL数据库并执行SQL查询操作
- C#使用NumericUpDown控件
猜你喜欢
IDEA找不到Database解决方法
ADS与C#通信
Solution for browser hijacking by hao360
MATLAB | 我也做了一套绘图配色可视化模板
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)
Optimization of five data submission methods
CentOS7 installation MySQL graphic detailed tutorial
中望3D 2023正式发布,设计仿真制造一体化缩短产品开发周期
A detailed explanation of the usage of Async and Await in C#
Error: npm ERR code EPERM
随机推荐
C#Assembly的使用
docker部署完mysql无法连接
SAP message TK 248 solved
IDEA连接MySQL数据库并执行SQL查询操作
Centos7 install mysql5.7
PyQt5快速开发与实战10.2 复利计算 && 10.3 刷新博客点击量
/run/NetworkManager占用空间过大
PHP序列化:eval
爱可可AI前沿推介(7.31)
IDEA如何运行web程序
集群的安全模式
Introduction to using NPM
六石编程学:不论是哪个功能,你觉得再没用,会用的人都离不了,所以至少要做到99%
Istio微服务治理网格的全方面可视化监控(微服务架构展示、资源监控、流量监控、链路监控)
Adding data nodes and decommissioning data nodes in the cluster
CentOS7 - yum install mysql
SAP e-commerce cloud Spartacus SSR Optimization Engine execution sequence of several timeouts
PyQt5 rapid development and actual combat 9.7 Automated testing of UI layer
SAP message TK 248 solved
Reasons and solutions for Invalid bound statement (not found)