简体   繁体   English

在Symfony2产品环境中的页面上打印错误日志消息

[英]Printing error log message on a page in Symfony2 prod environment

I am currently working on a Symfony2 project and as I go through to debug I get the occasional 500 error in my dev environment, which is fine as it tells me exactly the issue. 我目前正在开发一个Symfony2项目,在调试过程中,我的开发环境偶尔会出现500错误,这很好,因为它可以准确地告诉我这个问题。

For the prod environment, I have created several error templates so that the end user has a nicer interface when encountering errors like this, just in case I've missed something (since the dev environment is not accessible on my live server it's only the logs that help me). 对于生产环境,我创建了一些错误模板,以便最终用户在遇到此类错误时拥有更好的界面,以防万一我错过了一些东西(由于开发环境在我的实时服务器上不可访问,因此它只是日志)对我有帮助)。

However, if possible, I'd like to display part of the error log on the screen so if a client encounters a 500 error, they can recite the error to the development team. 但是,如果可能的话,我想在屏幕上显示错误日志的一部分,这样,如果客户遇到500错误,他们可以向开发团队举报错误。 What I'm asking is, is there a way to echo a line in the error prod.log to the screen via the twig template? 我要问的是,有没有一种方法可以通过树枝模板将错误prod.log中的一行回显到屏幕上?

Thank you Michael 谢谢迈克尔

它没有在任何地方真正提及(源代码除外),您应该使用exception.message变量获取完整的异常消息。

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

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