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

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -