public static void lookupHostname(ErrorReporter errorReporter) {
        String myHostName = getProperty(PROPERTY_LOGSTASH_GELF_HOSTNAME, "unknown");
        String myFQDNHostName = getProperty(PROPERTY_LOGSTASH_GELF_FQDN_HOSTNAME, "unknown");
        String myAddress = "";

        if (!Boolean.parseBoolean(getProperty(PROPERTY_LOGSTASH_GELF_SKIP_HOSTNAME_RESOLUTION, "false"))) {

            try {

                String resolutionOrder = getProperty(PROPERTY_LOGSTASH_GELF_HOSTNAME_RESOLUTION_ORDER,
                        RESOLUTION_ORDER_NETWORK_LOCALHOST_FALLBACK);

                InetAddress inetAddress = null;
                if (resolutionOrder.equals(RESOLUTION_ORDER_NETWORK_LOCALHOST_FALLBACK)) {
                    inetAddress = getInetAddressWithHostname();
                }

                if (resolutionOrder.equals(RESOLUTION_ORDER_LOCALHOST_NETWORK_FALLBACK)) {
                    if (isQualified(InetAddress.getLocalHost())) {
                        inetAddress = InetAddress.getLocalHost();
                    } else {
                        inetAddress = getInetAddressWithHostname();
                    }
                }

                if (inetAddress == null) {
                    inetAddress = InetAddress.getLocalHost();
                }

                myHostName = getHostname(inetAddress, false);
                myFQDNHostName = getHostname(inetAddress, true);
                myAddress = inetAddress.getHostAddress();
            } catch (IOException e) {
                errorReporter.reportError("Cannot resolve hostname", e);
            }
        }

        FQDN_HOSTNAME = myFQDNHostName;
        HOSTNAME = myHostName;
        ADDRESS = myAddress;
    }
public static void lookupHostname ( ErrorReporter errorReporter ) { String myHostName = getProperty ( PROPERTY_LOGSTASH_GELF_HOSTNAME , "unknown" ) ; String myFQDNHostName = getProperty ( PROPERTY_LOGSTASH_GELF_FQDN_HOSTNAME , "unknown" ) ; String myAddress = "" ; if ( ! Boolean . parseBoolean ( getProperty ( PROPERTY_LOGSTASH_GELF_SKIP_HOSTNAME_RESOLUTION , "false" ) ) ) { try { String resolutionOrder = getProperty ( PROPERTY_LOGSTASH_GELF_HOSTNAME_RESOLUTION_ORDER , RESOLUTION_ORDER_NETWORK_LOCALHOST_FALLBACK ) ; InetAddress inetAddress = null ; if ( resolutionOrder . equals ( RESOLUTION_ORDER_NETWORK_LOCALHOST_FALLBACK ) ) { inetAddress = getInetAddressWithHostname ( ) ; } if ( resolutionOrder . equals ( RESOLUTION_ORDER_LOCALHOST_NETWORK_FALLBACK ) ) { if ( isQualified ( InetAddress . getLocalHost ( ) ) ) { inetAddress = InetAddress . getLocalHost ( ) ; } else { inetAddress = getInetAddressWithHostname ( ) ; } } if ( inetAddress == null ) { inetAddress = InetAddress . getLocalHost ( ) ; } myHostName = getHostname ( inetAddress , false ) ; myFQDNHostName = getHostname ( inetAddress , true ) ; myAddress = inetAddress . getHostAddress ( ) ; } catch ( IOException e ) { errorReporter . reportError ( "Cannot resolve hostname" , e ) ; } } FQDN_HOSTNAME = myFQDNHostName ; HOSTNAME = myHostName ; ADDRESS = myAddress ; }
Triggers the hostname lookup.
@param errorReporter the error reporter