Thread.currentThread().getName() is not returning client IP address JBOSS EAP7.0

164 Views Asked by At

We are migrating server from jboss-portal to jboss EAP7.0. When I execute the code Thread.currentThread().getName() in portal result is returning client ip address. Where as if I use the same statement in jboss-eap 7.0 result (default task-20).

i wanted to print the client ip address in log file right now (%t) is works well in jboss-portal. Where as jboss-eap 7.0 results empty.

How do I achieve this? Thanks.

1

There are 1 best solutions below

0
On

You can use the pattern %h to print the host in the log file. For example (given the default logging configuration):

/subsystem=logging/pattern-formatter=COLOR-PATTERN:write-attribute(name=pattern, value="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %h %s%e%n")

Would print a log line like the following on the console:

08:21:01,540 INFO  [org.jboss.as.server] (Controller Boot Thread) localhost WFLYSRV0212: Resuming server
08:21:01,548 INFO  [org.jboss.as] (Controller Boot Thread) localhost WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
08:21:01,549 INFO  [org.jboss.as] (Controller Boot Thread) localhost WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
08:21:01,549 INFO  [org.jboss.as] (Controller Boot Thread) localhost WFLYSRV0025: WildFly Core 3.0.0.Beta22-SNAPSHOT "Kenny" started in 93ms - Started 87 of 90 services (23 services are lazy, passive or on-demand)