Grails App-Info plugin
I released a new Grails
plugin today, app-info
. This plugin exposes a lot of internal information for a Grails application. Most of the code for this plugin dates back a long time and was originally mostly JSPs that I would copy into whatever application I was working on to give myself a view into what's going on. Over time as I started using Spring and Hibernate I added more pages to display that information, and it now also shows information about Grails too.
Click any of the images to see the full-size version in a new window.
Configuration
This plugin uses the Dynamic Controller plugin
to modularize the controller actions as mixins. There are several of them and if there are some you don't want or need, you can exclude them. None are configured by default - that has to be done in your application's grails-app/conf/Config.groovy file. Here's the configuration from the sample application (download link at the end):
'com.burtbeckwith.grails.plugins.appinfo.IndexControllerMixin': 'com.burtbeckwith.appinfo_test.AdminManageController',
'com.burtbeckwith.grails.plugins.appinfo.HibernateControllerMixin': 'com.burtbeckwith.appinfo_test.AdminManageController',
'com.burtbeckwith.grails.plugins.appinfo.Log4jControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController',
'com.burtbeckwith.grails.plugins.appinfo.SpringControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController',
'com.burtbeckwith.grails.plugins.appinfo.MemoryControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController',
'com.burtbeckwith.grails.plugins.appinfo.PropertiesControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController',
'com.burtbeckwith.grails.plugins.appinfo.ScopesControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController'
]
With this configuration all of the URLs will start with http://localhost:8080/appname/adminManage. My preference is to re-map these in grails-app/conf/UrlMappings.groovy to http://localhost:8080/appname/admin/manage since I want the administration parts of the application under /admin/**. This is optional but if you want to do this see the configuration in the sample app.
Note: This plugin exposes a lot of information about your application so you're strongly recommended to use a security plugin and guard these URLs. The sample application uses the Spring Security Core
plugin but you're free to restrict access however you like, and optionally not even include this in your production war.
Usage
The Attributes menu has three entries:
Application
Displays all application-scope attributes from the ServletContext
Request
Displays all request-scope attributes from the current HttpServletRequest. Since this is for the current request, it's mostly useful to see what's available in a typical request.
Session
Displays all session-scope attributes from the current HttpSession. Since this is for the current request, it's mostly useful to see what's available in a typical session.
The Properties menu has three entries:
Data Source
A read/write view of the DataSource bean. Depending on the DataSource implementation, changing an attribute will take effect immediately and reset the connection pool
Grails Properties
Read-only view of the Grails Configuration.
System Properties
Read/write view of system properties. You can alter current properties or add new ones.
The Info menu has five entries:
Controllers
All controllers, plus links to all actions
Logging
Has comboboxes for all loggers to change the log level at runtime. Also has a text field to register a new Logger and its level.
Also includes a reverse-engineered log4j.xml based on the in-memory Log4j configuration. This is an estimate, so it may not be 100% accurate. But if you're having logging configuration issues and are familiar with the log4j.xml format, this can be convenient for diagnosing how things are misconfigured.
Memory
Graphs describing memory usage. Also has an action to trigger explicit garbage collection.
Sessions
Displays all current sessions and session-scope variables with a link to invalidate the session. This is enabled by default; to disable set grails.plugins.appinfo.useContextListener = false in grails-app/conf/Config.groovy
Spring Beans
Spring bean information for all beans in the "main" context and the parent context
The Hibernate menu has five entries and several sub-actions
Overview
- Properties
- Mappings Info
- Imports
- Auxiliary Database Objects
- Named Queries
- Named SQL Queries
- TypeDefs
- Filter Definitions
Entity Graphs
ER-style graphs of all Hibernate classes with relationships.
Table Graphs
ER-style graphs of all tables with relationships.
Caching
2nd-level cache information for StandardQueryCache, UpdateTimestampsCache, and all domain class caches.
Also has links to clear the cache and display usage graphs
Statistics
- General Hibernate statistics
- Links for statistics for each domain class
- Links for statistics for each collection
- Links for statistics for cached queries
Combos
On each page there are three combo boxes. The Tables combo box lists all database tables and selecting one displays detailed information for that table
The Entities combo box lists all entities (domain classes, JPA-annotated Java classes, and hbm.xml-mapped classes) and selecting one displays detailed information for each one
The hbm.xml combo box lists all entities and selecting one displays the reverse-engineered hbm.xml that would have created the equivalent entity. This is useful if you're having GORM mapping issues and want to see what the Hibernate configuration is
Sample Project
You can download a preconfigured sample application here
The /admin/** URLs in the sample app are restricted to users with ROLE_ADMIN. There's one user configured in BootStrap.groovy with username 'admin' and password 'password' with ROLE_ADMIN, so you can use that to authenticate.



























July 17th, 2010 03:31
Oh damn ! What a wonderful stack of admin utils. 1 billion congratz Burt
July 17th, 2010 05:57
This looks amazing!
I’ve got a bunch of disparate admin pages that I’ve carried with me between projects as well, but this plugin might just replace all of them.
Keep up the great work!
July 17th, 2010 16:18
Very very cool. Thanks Burt!
July 18th, 2010 14:52
Awesome!
July 18th, 2010 22:46
opening with winzip gets a: “error reading header …”
works on linux
July 19th, 2010 03:06
[...] información sobre Grails App-Info plugin (traducido al [...]
July 19th, 2010 08:01
Fantastic plugin! Thanks Burt, had no problem with install or dependencies! The only suggestion I would have is to start home page (/admin/manage or /adminManage) with something more than menu, maybe Application Scope Variables.
Thanks Burt!
July 19th, 2010 08:09
This will be very useful plug-in and saves lot of time in adding admin capabilities to the application.
July 20th, 2010 04:18
this looks great! Thanks a lot.
July 20th, 2010 08:57
[...] http://burtbeckwith.com/blog/?p=344 [...]
July 20th, 2010 10:23
[...] http://burtbeckwith.com/blog/?p=344 [...]
July 20th, 2010 15:50
Dude… must say excellent work… Thanks!
July 21st, 2010 15:12
Excellent job Burt. We are adding this plugin as soon as we can for sure.
July 30th, 2010 13:49
Is the source-code available somewhere?
July 30th, 2010 14:02
@Rodrigo the plugin zips contain the source and are compiled with your application code. For the full source code, most plugins keep their source in SVN at http://plugins.grails.org/ and this one is at http://plugins.grails.org/grails-app-info/
July 30th, 2010 14:13
Thank you, Burt.