Created
May 15, 2015 09:12
-
-
Save holacode/5314433c519fb6956ac6 to your computer and use it in GitHub Desktop.
Adding Java Melody to Grails App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adding Java Melody to Grails App | |
Plugin Url : https://grails.org/plugin/grails-melody | |
Installation step provided does not work with grails 2.3.4 or above. | |
This method to install plugin has been deprecated in new version of grails. | |
grails install-plugin grails-melody | |
To Add Java Melody to Grails App add following dependency in you BuildConfig.groovy in Plugin | |
Section. | |
plugins { | |
compile ":grails-melody:1.56.0" | |
// 1.56.0 add latest version as per your requirement | |
} | |
After this save your BuildConfig.groovy file and compile you grails Application : | |
cd in you grails App directory and run :$ grails compile | |
Checkout console messages grails will install java melody jar and add GrailsMelodyConfig.groovy | |
in your grails-app/config folder. (in same directory as your BuildConfig,groovy). | |
You can use this file to configure java melody properties : | |
Please refer for mode details but remember to properties in grails dsl style not xml : http://code.google.com/p/javamelody/wiki/UserGuide | |
Example : | |
javamelody.'displayed-counters' = 'http,sql,error,log,spring,jsp' | |
javamelody.'sql-transform-pattern' = '\\d+' | |
javamelody.'http-transform-pattern' = '\\d+' //filter out numbers from URI | |
javamelody.'url-exclude-pattern' = '/static/.*' | |
Last and final step to configure endpoint of JavaMelody | |
http://localhost:8080/<YourContext>/monitoring | |
Edit your Config.groovy file and add following line in your file. | |
Always ensure to secure monitoring/** url path under some password | |
protected spring role. ROLE_ADMIN in our example. | |
grails.plugins.springsecurity.interceptUrlMap = [ | |
'/monitoring/**': ['ROLE_ADMIN'], | |
'/admin/**': ['ROLE_ADMIN']] | |
] | |
Thats it , run your grails app and access http://localhost:8080/<YourContext>/monitoring, | |
provide the password and you should see java melody UI. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment