【问题标题】:Symfony 2.8 disable security/request.INFO loggingSymfony 2.8 禁用 security/request.INFO 日志记录
【发布时间】:2016-06-23 10:15:49
【问题描述】:

Symfony 正在为我的应用程序中的每个 请求记录两个INFO 级别的语句,从而非常迅速地膨胀一个 apache 日志文件。我们没有使用 Monolog(使用替代解决方案),我已通过删除 AppKernel 中的捆绑包来禁用它。

[2016-06-23 12:11:04] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2016-06-23 12:11:06] request.INFO: Matched route "contact". {"route_parameters":{"_controller": ...

如何禁用此日志记录?

【问题讨论】:

标签: symfony


【解决方案1】:

这是因为 Monolog(即使你在应用中禁用它,symfony 也会使用它自己)defaults to std:error:

public function addRecord($level, $message, array $context = array())
{
    if (!$this->handlers) {
        $this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
    }

在app/config/config.yml 中添加any 处理程序将使addRecord 拒绝不需要的信息通知。

monolog:
    handlers:
        syslog:
            type: syslog
            level: error

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-17
    • 2011-06-22
    • 2015-04-21
    • 2015-02-01
    • 2012-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多