Examples of ErrorItem


Examples of org.apache.log4j.spi.ErrorItem

   * Dump any errors on System.out.
   */
  public void dumpErrors() {
    List errorList = getErrorList();
    for(int i = 0; i < errorList.size(); i++) {
      ErrorItem ei = (ErrorItem) errorList.get(i);
      ei.dump(System.out);
    }
  }
View Full Code Here

Examples of org.apache.log4j.spi.ErrorItem

    String value = attributes.getValue(VALUE_ATTRIBUTE);

    if (name == null) {
      inError = true;
      getLogger().error(NO_NAME);
      ec.addError(new ErrorItem(NO_NAME));
      return;
    }

    if (value == null) {
      inError = true;
      getLogger().error(NO_VALUE);
      ec.addError(new ErrorItem(NO_VALUE));
      return;
    }

    // remove both leading and trailing spaces
    value = value.trim();
View Full Code Here

Examples of org.apache.log4j.spi.ErrorItem

    Object o = ec.getObjectStack().get(0);
    if(o instanceof LoggerRepository) {
      return (LoggerRepository) o;
    } else {
      String errMsg = "There is no LoggerRepository at the top of the object stack.";
      ec.addError(new ErrorItem(errMsg));
      throw new IllegalStateException(errMsg);
    }
  }
View Full Code Here

Examples of org.apache.log4j.spi.ErrorItem

        if(getNamingContext() == null) {
            try {
                findNamingContext();
            } catch (Exception e) {
                getLogger().error("Couldn't find JNDI naming context: ", e);
                ec.addError(new ErrorItem("Couldn't find JNDI naming context.", e));
            }
        }

        String jndiName = attributes.getValue(JNDI_ATTR);
       
        if((jndiName == null) || (jndiName.trim().length() < 1)) {
            getLogger().warn("Missing {} attribute, ignoring.", JNDI_ATTR);
        } else if(getNamingContext() != null){
            Object value = null;

            try {
                value = getNamingContext().lookup(jndiName);
            } catch (Exception e) {
                getLogger().error("Error looking up " + jndiName + ": ", e);
                ec.addError(new ErrorItem("Error looking up " + jndiName, e));
            }

            if(value == null) {
                getLogger().warn("No JNDI value found for {}.", jndiName);
            } else if(! (value instanceof String)) {
View Full Code Here

Examples of org.apache.log4j.spi.ErrorItem

    if (Option.isEmpty(conversionWord)) {
      inError = true;
      errorMsg = "No 'conversionWord' attribute in <conversionRule>";
      getLogger().warn(errorMsg);
      ec.addError(new ErrorItem(errorMsg));

      return;
    }

    if (Option.isEmpty(converterClass)) {
      inError = true;
      errorMsg = "No 'converterClass' attribute in <conversionRule>";
      getLogger().warn(errorMsg);
      ec.addError(new ErrorItem(errorMsg));

      return;
    }

    try {
      getLogger().debug(
        "About to add conversion rule [{}, {}] to layout", conversionWord, converterClass);

      LoggerRepository repository = (LoggerRepository) ec.getObjectStack().get(0);

      Map ruleRegistry = (Map) repository.getObject(PatternLayout.PATTERN_RULE_REGISTRY);
      if(ruleRegistry == null) {
        ruleRegistry = new HashMap();
        repository.putObject(PatternLayout.PATTERN_RULE_REGISTRY, ruleRegistry);
      }
      // put the new rule into the rule registry
      ruleRegistry.put(conversionWord, converterClass);
 
    } catch (Exception oops) {
      inError = true;
      errorMsg = "Could not add conversion rule to PatternLayout.";
      getLogger().error(errorMsg, oops);
      ec.addError(new ErrorItem(errorMsg));
    }
  }
View Full Code Here

Examples of org.apache.log4j.spi.ErrorItem

    } catch (Exception oops) {
      inError = true;
      getLogger().error(
        "Could not create a plugin. Reported error follows.", oops);
      ec.addError(
        new ErrorItem(
          "Could not create plugin of type " + className + "]."));
    }
  }
View Full Code Here

Examples of org.apache.log4j.spi.ErrorItem

      props.load(istream);
      istream.close();
    } catch (IOException e) {
      String errMsg =
        "Could not read configuration file [" + configFileName + "].";
      addError(new ErrorItem(errMsg, e));
      getLogger(repo).error(errMsg, e);
      return;
    }

    // If we reach here, then the config file is alright.
View Full Code Here

Examples of org.apache.log4j.spi.ErrorItem

      props.load(in);
      in.close();
    } catch (java.io.IOException e) {
      String errMsg =
        "Could not read configuration file from URL [" + configURL + "].";
      addError(new ErrorItem(errMsg, e));
      getLogger(repository).error(errMsg, e);
      return;
    }

    doConfigure(props, repository);
View Full Code Here

Examples of org.apache.log4j.spi.ErrorItem

    try {
      props.load(configStream);
    } catch (java.io.IOException e) {
      String errMsg =
        "Could not read configuration file from input stream.";
      addError(new ErrorItem(errMsg, e));
      getLogger(repository).error(errMsg, e);
      return;
    }

    doConfigure(props, repository);
View Full Code Here

Examples of org.apache.log4j.spi.ErrorItem

        props, prefix, org.apache.log4j.Appender.class, null);

    if (appender == null) {
      String errMsg =
        "Could not instantiate appender named \"" + appenderName + "\".";
      addError(new ErrorItem(errMsg));
      getLogger(repository).error(errMsg);
      return null;
    }

    appender.setName(appenderName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.