如何停止原则来记录查询 [英] how to stop doctrine to log queries

查看:120
本文介绍了如何停止原则来记录查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,当我检查我的app / log / dev.log我可以看到我的dev.log中几乎所有的查询都被实时登录:

  [2015-01-27 06:57:22] doctrine.DEBUG:SELECT t0.username A .... 
[2015-01-27 06: 57:23] doctrine.DEBUG:SELECT t0.username A ...
[2015-01-27 06:57:23] doctrine.DEBUG:SELECT s0_.id ......

我不知道为什么会发生这种情况,因为我在生产模式下运行网站,当我在我的config.yml,这是我看到的:

  monolog:
处理程序:
图片:
type:stream
path:%kernel.logs_dir%/ pictures_%kernel.environment%.log
level:info
instagram:
type:stream
path :%kernel.logs_dir%/ instagram_%kernel.environment%.log
级别:info

这是我的config_dev.yml看起来像:

  import:
- {resource:config.yml}

框架:
路由器:{resource: %kernel.root_dir%/ config / routing_dev.yml}
profiler:{only_exceptions:false}

web_profiler:
工具栏:true
intercept_redirects:false

monolog:
处理程序:
主要:
类型:流
路径:%kernel.logs_dir%/%kernel.environment%.log
级别:debug
firephp:
类型:firephp
级别:info

assetic:
use_controller:false

hip_mandrill:
disable_delivery:true

任何想法如何发生?

解决方案

您应该在生产服务器上使用 prod env。在 prod env doctrine的日志记录被默认禁用。



但是,如果你想禁用日志记录(在所有环境),您需要设置一个 config.yml

  doctrine:
dbal:
connections:
conn1:
driver:...
...
logging:false
profiling :false


I have a weird issue, when I checked my app/log/dev.log I can see almost all of my queries in my dev.log being logged in real time:

[2015-01-27 06:57:22] doctrine.DEBUG: SELECT t0.username A ....
[2015-01-27 06:57:23] doctrine.DEBUG: SELECT t0.username A ...
[2015-01-27 06:57:23] doctrine.DEBUG: SELECT s0_.id ......

I have no idea why this is happening, since I am running the site on production mode also when I check monolog in my config.yml ,this is what I see:

monolog:
    handlers:
        pictures:
            type: stream
            path: %kernel.logs_dir%/pictures_%kernel.environment%.log
            level: info
        instagram:
            type: stream
            path: %kernel.logs_dir%/instagram_%kernel.environment%.log
            level: info

here's what my config_dev.yml looks like:

imports:
    - { resource: config.yml }

framework:
    router:   { resource: "%kernel.root_dir%/config/routing_dev.yml" }
    profiler: { only_exceptions: false }

web_profiler:
    toolbar: true
    intercept_redirects: false

monolog:
    handlers:
        main:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug
        firephp:
            type:  firephp
            level: info

assetic:
    use_controller: false

hip_mandrill:
    disable_delivery: true    

any idea how this could be happening?

解决方案

You should use prod env on your production server. In the prod env doctrine's logging is disabled by default.

But if you want to disable logging at all (in all environments) you need to set up a config.yml like that:

doctrine:
    dbal:
        connections:
            conn1:
                driver: ...
                ...
                logging: false
                profiling: false

这篇关于如何停止原则来记录查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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