I do a bit of logging in a ServletFilter to log which web services are being called, response times, etc, and I would ideallly like to log the domain name开发者_StackOverflow社区 of the running Glassfish server. But so far I have not been able to come up with any way of programmatically access this info.
Do any of you know of a way to access this info from the currently running web application?
org.glassfish.admin.amx.base.DomainRoot seems to have some methods that might give some info, but I have no idea on what classes implement these interfaces.
You can get it from a system property:
String instanceRoot = System.getProperty("com.sun.aas.instanceRoot");
For my glassfish installation this results in:
C:\glassfishv3\glassfish\domains\domain1
There is a related property called instanceName:
String instanceName = System.getProperty("com.sun.aas.instanceName");
which results in the output
server
精彩评论