Log stack traces in prod mode with Play applications
When a Play application encounters a 500 error while running in Production mode, it will log the error like so:
[TIMESTAMP]: @[errorid]
[TIMESTAMP]: Internal Server开发者_如何学C Error (500) for request GET /path-to-request
[TIMESTAMP]: Execution exception (In /app/controllers/Controller.java around line 55)
No stack trace is included. Is it possible to configure Play so that stack trace is logged?
Bonus question: is it possible to limit the size of stack traces in logs to, say, 20 lines each to prevent runaway log growth?
You can't limit the output of the log by default, but you can set a log4j.properties and add a file-based log.
On the error, the log itself says the reason: (In /app/controllers/Controller.java around line 55). If you are in development mode and try to access that URL you'll get a report with the error.
I assume you replaced the real path with "/path-to-request". If not probably that's the reason, that path may not exist at all in your routes file.
I can't find any limitations to the log, which depends on the PROD-Mode. I would recommend to debug the error and look in the code of the framework.
精彩评论