try {
InetAddress localhost = InetAddress.getLocalHost();
log.info(" IP Addr: " + localhost.getHostAddress());
// Just in case this host has multiple IP addresses....
InetAddress[] allMyIps = InetAddress.getAllByName(localhost.getCanonicalHostName());
if (allMyIps != null && allMyIps.length > 1) {
log.info(" Full list of IP addresses:");
for (int i = 0; i < allMyIps.length; i++) {
log.info(" " + allMyIps[i]);
}
}
} catch (UnknownHostException e) {
log.info(" (error retrieving server host name)");
}
try {
log.info("Full list of Network Interfaces:");
for (Enumeration
en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
NetworkInterface intf = en.nextElement();
log.info(" " + intf.getName() + " " + intf.getDisplayName());
for (Enumeration enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
log.info(" " + enumIpAddr.nextElement().toString());
}
}
} catch (SocketException e) {
log.info(" (error retrieving network interface list)");
}