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. Re: System property to determine server ip address. You do know that you can view all of the system properties using the jmx-console, right? http://localhost:8080/jmx-console, select the name=Properties,type=Service MBean under 'jboss' and click Invoke next the the showAll operation.
To monitor the log file (e.g. server. log) you can use the tail -f command in this case Linux / Cygwin. It is real-time reading the log and with Ctrl + C command you can close the tail -f command and not lose any of your data (you can open it again with any text editor). Note: path/jboss-eap-6.0/standalone/log/server.
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())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With