How to log ip address on JBoss

戏子无情 提交于 2020-01-22 22:49:22

问题


I want to log the IP address of the client who is calling my WS.

How can I do that on JBoss?

EDIT:

I would like to use log4J configuration on JBOSS if possible.


回答1:


Append the following to your conversion pattern parameter in log4j configuration xml.

%X{RemoteAddress}

And in your code you can log the ip address as follows:

MDC.put("RemoteAddress", request.getRemoteAddr())



回答2:


Read this, in case you are provind functionality via EJB3.



来源:https://stackoverflow.com/questions/3346365/how-to-log-ip-address-on-jboss

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!