2017-10-18 83 views
0

當我運行Symfony命令(使用bin/console)時,我在輸出中獲取Redis日誌。如何在命令執行過程中禁用Redis日誌

例如:

$ bin/console doctrine:generate:entities AppBundle:Item 

[2017-10-18 13:26:47] cache.WARNING: Failed to save key "{key}" ({type}) {"key":"%5BAppBundle%5CEntity%5CItem%40%5BAnnot%5D%5D%5B1%5D","type":"array","exception":null} 
[2017-10-18 13:26:47] cache.WARNING: Failed to save key "{key}" ({type}) {"key":"%5B%5BC%5DAppBundle%5CEntity%5CItem%24property_1%40%5BAnnot%5D%5D%5B1%5D","type":"integer","exception":null} 
[2017-10-18 13:26:47] cache.WARNING: Failed to save key "{key}" ({type}){"key":"%5B%5BC%5DAppBundle%5CEntity%5CItem%24property_2%40%5BAnnot%5D%5D%5B1%5D","type":"integer","exception":null} 
Generating entity "AppBundle\Entity\Item" 
[2017-10-18 13:26:47] cache.WARNING: Failed to save key "{key}" ({type}) {"key":"%5B%5BC%5DAppBundle%5CEntity%5CItem%24property_3%40%5BAnnot%5D%5D%5B1%5D","type":"integer","exception":null} 
... and at least 100 more 

> backing up Item.php to Item.php~ 
> generating AppBundle\Entity\Item 

這使得命令的實際輸出難以閱讀。

回答

1

snc_redis.phpredis.default/Snc\RedisBundle\Client\Phpredis\Client服務只是圍繞原始\Redis類添加日誌記錄的包裝。

您可以關閉配置實例的日誌記錄,也可以直接使用Redis類。

日誌記錄通常設置爲「%kernel.debug%」,它應該避免登錄env = prod。

snc_redis: 
    clients: 
     default: 
      type: predis 
      alias: default 
      dsn: redis://localhost 
      # usually "%kernel.debug%" to enable in dev 
      logging: false 

如果你不使用sncRedis,我們需要你使用什麼樣的機制能夠幫助更多的信息。