public void activateOptions()

in src/main/java/org/apache/log4j/receivers/net/MulticastAppender.java [93:133]


  public void activateOptions() {
    try {
      hostname = InetAddress.getLocalHost().getHostName();
    } catch (UnknownHostException uhe) {
      try {
        hostname = InetAddress.getLocalHost().getHostAddress();
      } catch (UnknownHostException uhe2) {
        hostname = "unknown";
      }
    }

    //allow system property of application to be primary
    if (application == null) {
      application = System.getProperty(Constants.APPLICATION_KEY);
    } else {
      if (System.getProperty(Constants.APPLICATION_KEY) != null) {
        application = application + "-" + System.getProperty(Constants.APPLICATION_KEY);
      }
    }

    if(remoteHost != null) {
      address = getAddressByName(remoteHost);
    } else {
      String err = "The RemoteHost property is required for MulticastAppender named "+ name;
      LogLog.error(err);
      throw new IllegalStateException(err);
    }

    if (layout == null) {
        layout = new XMLLayout();
    }
      
    if (advertiseViaMulticastDNS) {
        Map properties = new HashMap();
        properties.put("multicastAddress", remoteHost);
        zeroConf = new ZeroConfSupport(ZONE, port, getName(), properties);
        zeroConf.advertise();
    }
    connect();
    super.activateOptions();
  }