简体   繁体   English

Symfony2日志记录无法在生产中使用

[英]Symfony2 logging not working in production

In my symfony application when looking at the app/logs directory its completely empty and nothing seems to be logging on production however on my dev environment it works just fine. 在我的symfony应用程序中,当查看app / logs目录时,它完全是空的,似乎没有任何东西可以登录生产,但是在我的开发环境中,它工作得很好。

in my /web/app.php file i have 在我的/web/app.php文件中

$environments = array(
   'dev.url.com'         => 'dev',
   'produ.url.com'       => 'prod'
);

when looking at the /app/logs directory the folder is completely empty there isnt even a prod.log file however if i go into my /web/app.php file and change the value from prod to dev on the same server it starts to log everything just fine. 当查看/ app / logs目录时,文件夹完全为空,甚至没有prod.log文件,但是,如果我进入/web/app.php文件并将值从prod更改为同一服务器上的dev,它将开始记录一切都很好。

I do have a /app/config/config_prod.yml and a config_dev.yml 我确实有一个/app/config/config_prod.yml和一个config_dev.yml

I cant figure out if there is a setting somewhere that is blocking this from working when the environment is set to prod? 当环境设置为prod时,我无法确定是否有某个设置阻止此设置正常工作? I have all the correct permissions on the directories as well too. 我也对目录具有所有正确的权限。

Permissions can often be the issue here - make sure write permissions are granted for both the web server (or PHP user - depending on your setup) - plus make sure if you have been running any console scripts from the commandline - then make sure that user can write too. 权限通常是这里的问题-确保同时授予Web服务器(或PHP用户-取决于您的设置)的写权限-并确保您是否已从命令行运行任何控制台脚本-然后确保该用户也可以写。

Also ensure that the cache directory has write enabled too. 还要确保缓存目录也启用了写功能。

There are additional setup hints in the great Symfony documentation. 出色的Symfony文档中还有其他设置提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM