/**
   * Read configuration options from <code>properties</code>.
   *
   * <p>See {@link #doConfigure(String, LoggerRepository)} for the expected format.
   */
  public void doConfigure(Properties properties, LoggerRepository hierarchy) {
    repository = hierarchy;
    String value = properties.getProperty(LogLog.DEBUG_KEY);
    if (value == null) {
      value = properties.getProperty("log4j.configDebug");
      if (value != null)
        LogLog.warn("[log4j.configDebug] is deprecated. Use [log4j.debug] instead.");
    }

    if (value != null) {
      LogLog.setInternalDebugging(OptionConverter.toBoolean(value, true));
    }

    //
    //   if log4j.reset=true then
    //        reset hierarchy
    String reset = properties.getProperty(RESET_KEY);
    if (reset != null && OptionConverter.toBoolean(reset, false)) {
      hierarchy.resetConfiguration();
    }

    String thresholdStr = OptionConverter.findAndSubst(THRESHOLD_PREFIX, properties);
    if (thresholdStr != null) {
      hierarchy.setThreshold(OptionConverter.toLevel(thresholdStr, (Level) Level.ALL));
      LogLog.debug("Hierarchy threshold set to [" + hierarchy.getThreshold() + "].");
    }

    configureRootCategory(properties, hierarchy);
    configureLoggerFactory(properties);
    parseCatsAndRenderers(properties, hierarchy);

    LogLog.debug("Finished configuring.");
    // We don't want to hold references to appenders preventing their
    // garbage collection.
    registry.clear();
  }