问题描述
我希望能够使用 javaagent 运行 Play Framework 2.0 服务器.
I would like to be able to run the Play Framework 2.0 server with a javaagent.
网络上的一些资源(请参阅此处和这里 )表明这可以只需将 -javaagent:/path/to/agent.jar
附加到 play run
即可完成,但它似乎对我不起作用.
Some resources on the web (see here and here ) suggest that this could be done simply by appending -javaagent:/path/to/agent.jar
to play run
but it doesn't seems to work for me.
有什么线索吗?
推荐答案
在不修改脚本的情况下,没有干净的方法可以将 -javaagent 参数传递给 play 2.0.1-2.0.4 的 java 命令调用.
There is no clean way to pass the -javaagent parameter to the java command invocation with play 2.0.1-2.0.4 without modifying a script.
我能够使用以下技术让 javaagent 工作:
I was able to get a javaagent working using the following technique:
# Modify the play/framework/build script to include an extra environment variable
sed -i 's/^java( ${PLAY_OPTS})?/java ${PLAY_OPTS}/' ${playPath}/framework/build
然后可以像这样传递 -javaagent 参数:
Then it is possible to pass the -javaagent param like this:
export PLAY_OPTS='-javaagent:/lib/newrelic/newrelic.jar'
${playPath}/play -Dconfig.file=conf/prod.conf -Dlogger.file=conf/prod-logger.xml start
更新
一个不幸的旁注 - 我刚刚从 New-Relic 支持中发现,New-Relic 目前绝对不支持 play-framework 2.x (2012-10-04).
An unfortunate sidenote- I just found out from New-Relic support that New-Relic definitely does not support play-framework 2.x right now (2012-10-04).
这篇关于是否可以使用 javaagent 运行 Play Framework 2.0 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!