一般而言,我是Laravel和PHP的新手,我正在尝试清理我的errorLog。我使用的当前错误日志是Laravel的laravel.log文件,该文件位于/app/storage/logs中。
有没有一种简单的方法来清除laravel.log文件?删除它安全吗?它会在需要的时候重建吗?
我使用的是最新版本的Ubuntu。谢谢!
发布于 2015-02-08 17:17:23
将一个空字符串回显到它将会起作用,如下所示:
echo "" > storage/logs/laravel.logThe The The
最高效
将会是
它的大小为零:
truncate -s 0 /app/storage/logs/laravel.log发布于 2018-09-24 03:58:58
这是一个可重用的
可以节省您的时间和精力的命令:)
Artisan::command('logs:clear', function() {
exec('rm -f ' . storage_path('logs/*.log'));
exec('rm -f ' . base_path('*.log'));
$this->comment('Logs have been cleared!');
})->describe('Clear log files');把这个放进去
那就跑吧
更新:
添加
对于
根目录下的etc日志。
添加
至
函数来抑制
消息。
发布于 2018-07-07 19:05:32
只需将此行添加到您想要清除日志的位置即可。
https://stackoverflow.com/questions/28127495
复制相似问题