java - How to log ip address on JBoss -


I want to log the client's IP address which is calling my WS.

How can I do that?

Edit:

If possible, I would like to use log4J configuration on JBOSS.

Add your conversion pattern parameters to the log4j configuration xml.

 % X {Remote adder}  

and in your code you can log the IP address as follows:

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

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -