当前位置:网站首页>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 {
// ...
}边栏推荐
- ADS与C#通信
- 基于去噪自编码器的故障隔离与识别方法
- 查看Mysql数据库版本
- 分布式锁有哪些,怎么实现(分布式锁的三种实现的对比)
- 【牛客刷题-SQL大厂面试真题】NO3.电商场景(某东商城)
- SAP 电商云 Spartacus SSR Optimization Engine 几处 timeout 的执行顺序
- Network layer key protocol - IP protocol
- FastAPI encapsulates a generic response
- [Niu Ke brush questions - SQL big factory interview questions] NO3. E-commerce scene (some east mall)
- C#高级--委托
猜你喜欢

电脑重要文件很多,如何备份比较安全?

Ali on three sides: MQ message loss, repetition, backlog problem, how to solve?

Solution for browser hijacking by hao360

C#使用ComboBox控件

C# control ToolStripProgressBar usage

Golang - gin - pprof - use and safety

Architecture Camp | Module 8

Introduction to the PartImageNet Semantic Part Segmentation dataset

PyQt5 rapid development and actual combat 10.2 compound interest calculation && 10.3 refresh blog clicks

Reasons and solutions for Invalid bound statement (not found)
随机推荐
Invalid bound statement (not found)出现的原因和解决方法
SAP message TK 248 solved
PyQt5快速开发与实战 10.1 获取城市天气预报
The importance of strategic offensive capability is much higher than strategic defensive capability
Centos7 install mysql5.7
战略进攻能力的重要性,要远远高于战略防守能力
C# control ToolStripProgressBar usage
Selenium IDE for Selenium Automation Testing
C#使用ComboBox控件
Batch大小不一定是2的n次幂!ML资深学者最新结论
知名无人驾驶公司:文远知行内推
Architecture Camp | Module 8
Verilog——基于FPGA的贪吃蛇游戏(VGA显示)
图像大面积缺失,也能逼真修复,新模型CM-GAN兼顾全局结构和纹理细节
Selenium自动化测试之Selenium IDE
C#高级--委托
Reasons and solutions for Invalid bound statement (not found)
centos7安装mysql5.7
Solution for browser hijacking by hao360
NameNode故障处理的两种方法