Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Play 2.2 doesn't support javaagent

With previous version of the Java Play framework, we could provide a command line argent to load monitoring agents. For example, NewRelic could be loaded as

./path/to/start -javaagent:/path/to/newrelic.jar

With the release of the 2.2, the Play team has significantly changed the start script. From what I can tell, it no longer supports javaagents. Has any else gotten NewRelic running with Java Play 2.2+? Play is great, but its useless tech if you can't monitor it in a production environment...

like image 723
Chris Avatar asked Sep 28 '13 19:09

Chris


2 Answers

It seems that you can prefix Java options with -J (in a manner similar to system properties using -D):

$ bin/<app> -J-javaagent:lib/newrelic.jar

Discovered this while poking around in the script itself but it is noted in the usage summary:

$ bin/<app> -h
Usage:  [options]    
...
  -J-X               pass option -X directly to the java runtime
                     (-J is stripped)
...
like image 97
penfold Avatar answered Nov 04 '22 06:11

penfold


With the new native packager in Play Framework 2.2 you need to set Java options in the JAVA_OPTS environment variable.

like image 36
James Ward Avatar answered Nov 04 '22 06:11

James Ward