Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log ip address on JBoss

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.

like image 633
Diego Dias Avatar asked Jul 27 '10 17:07

Diego Dias


People also ask

How do I find my JBoss server IP address?

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.

How do I view JBoss logs?

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.


Video Answer


1 Answers

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())
like image 133
Sasi Avatar answered Sep 28 '22 03:09

Sasi