ThinkPHP is a very popular PHP development framework. It provides very rich and practical functions, but it will inevitably generate some log files during use. These log files occupy a certain amount of disk space. If they are not cleaned up in time, they will Put a certain amount of pressure on the server. This article will introduce how to clear ThinkPHP logs.
1. Understanding ThinkPHP logs
In the process of using ThinkPHP, the following two types of logs will be generated:
1. System logs: stored in runtime# The
log folder under the ## directory includes request logs, exception logs, etc.
sql folder under the
runtime directory, recording detailed information about SQL execution.
log and
sql folders in the
runtime directory, and directly delete all the files in the folders.
config.php. Taking the log cleaning once a day as an example, we can add the following code in
config.php:
// 定时清理日志文件 'log' => [ // 日志记录方式,支持 file sae 'type' => 'file', // 日志保存目录 'path' => LOG_PATH, // 日志记录级别 'level' => [], // 日志清除时间,单位:天 'clear_time' => 1, ],
clear_time.
The above is the detailed content of How to clear thinkphp logs (two methods). For more information, please follow other related articles on the PHP Chinese website!