当前位置:网站首页>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 {
// ...
}
边栏推荐
- sqlalchemy determines whether a field of type array has at least one consistent data with an array
- Using SQL Server FOR XML and FOR JSON syntax on other RDBMSs with jOOQ
- PartImageNet物体部件分割(Semantic Part Segmentation)数据集介绍
- 阿里三面:MQ 消息丢失、重复、积压问题,怎么解决?
- All-round visual monitoring of the Istio microservice governance grid (microservice architecture display, resource monitoring, traffic monitoring, link monitoring)
- C#中+=的用法
- 网络层重点协议——IP协议
- C# using NumericUpDown control
- 滑窗法切分数据
- IDEA找不到Database解决方法
猜你喜欢
Grab the tail of gold, silver and silver, unlock the programmer interview "Artifact of Brushing Questions"
Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法
IDEA的database使用教程(使用mysql数据库)
操作符详解
C# control ToolStripProgressBar usage
Network layer key protocol - IP protocol
Ali on three sides: MQ message loss, repetition, backlog problem, how to solve?
[Niu Ke brush questions - SQL big factory interview questions] NO3. E-commerce scene (some east mall)
ECCV2022: Recursion on Transformer without adding parameters and less computation!
C#使用ComboBox控件
随机推荐
Detailed explanation of network protocols and related technologies
C# control StatusStrip use
C#中+=的用法
清除浮动的四种方式及其原理理解
网络层重点协议——IP协议
Text similarity calculation (Chinese and English) detailed explanation of actual combat
/run/NetworkManager占用空间过大
C# control ToolStripProgressBar usage
mysql8, starttime的下一个值作为endtime的上一个值?
pytorch gpu版本安装最新
CentOS7 安装MySQL 图文详细教程
IDEA版Postman插件Restful Fast Request,细节到位,功能好用
ICML2022 | Fully Granular Self-Semantic Propagation for Self-Supervised Graph Representation Learning
报错:npm ERR code EPERM
求一份常见Oracle故障模拟场景
A detailed explanation of the usage of Async and Await in C#
硬盘分区,拓展C盘,不重装系统,不重装D盘软件的全教程。
Four ways to clear the float and its principle understanding
Edge Cloud Explained in Simple Depth | 4. Lifecycle Management
基于高阶微分器的无模型滑模控制器及其在自动电压调节器中的应用