Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run Play Framework 2.0 server with a javaagent?

I would like to be able to run the Play Framework 2.0 server with a javaagent.

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.

Any clues?

like image 566
Tahir Akhtar Avatar asked Jun 13 '12 10:06

Tahir Akhtar


1 Answers

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.

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

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


Update

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).


like image 186
Jay Taylor Avatar answered Dec 21 '22 08:12

Jay Taylor