在 symfony 2 中清除日志文件的命令 [英] Command to clear log files in symfony 2

查看:24
本文介绍了在 symfony 2 中清除日志文件的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一个命令可以清除 Symfony 2 中的日志文件?虽然有 php app/console cache:clear 清除缓存,但我不知道任何清除日志文件(logs/dev.log 和 logs/prod.log)的命令.我总是手动清除这些日志.谢谢

I was wondering if there is a command to clear the log files in Symfony 2 ? While there is the php app/console cache:clear to clear the cache, I don't know any command to clear the log files (logs/dev.log and logs/prod.log). I have always cleared these logs manually. Thank you

推荐答案

Symfony 中没有明确的命令.但是使用 shell one-liner 并没有什么可耻的:

There's no explicit command in Symfony. But using a shell one-liner is nothing to be ashamed of:

# straightforward …
echo -n '' > app/logs/dev.log

# … or l33t
> app/logs/dev.log # works at least in bash, haven't tried others

这篇关于在 symfony 2 中清除日志文件的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆