简体   繁体   中英

Print IP address in Server. Log for wildfly 10 server

As of now in the log file I can see 17:08:19,813 INFO [CLASS NAME] ( default task - 1 ) Hello.

Now I want to show IP address where application is deployed instead of default task in the log.

For example: 17:08:19,813 INFO [CLASS NAME] ( 10.123.456.789:8380 - 1 ) Hello.

What should I need to change in my standalone.xml file for the wildfly 10.1.0 server.

I am using below pattern to print the log.

"%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"

You can use %h for the short host name or %H for the fully qualified host name. The WildFly Documentation has a table of all the valid patterns. Note that the value "default task - 1" is the thread name.

With CLI you can change the pattern at runtime without having to reboot the server.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM