How to log ip address on JBoss

2019-04-09 09:14发布

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.

2条回答
Animai°情兽
2楼-- · 2019-04-09 09:35

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

查看更多
我命由我不由天
3楼-- · 2019-04-09 09:43

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())
查看更多
登录 后发表回答