开发者

How can I log the Glassfish domain?

开发者 https://www.devze.com 2023-02-19 12:55 出处:网络
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 Glassf

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号