stanfordnlp/CoreNLP · error · IllegalArgumentException

Unknown value for log.method

Error message

Unknown value for log.method

What it means

RedwoodConfiguration.output(String method) maps the 'log.method' configuration property to a logging backend. It only accepts stderr, stdout, (a file) and java.util.logging; any other value throws this IllegalArgumentException.

Solutions

  1. Set log.method to one of: stderr, stdout, java.util.logging, or a file path.
  2. Check spelling/case: the comparison is case-insensitive equalsIgnoreCase, so fix the value text, not capitalization.
  3. To route through SLF4J, build the configuration programmatically with RedwoodConfiguration.empty().handlers(...) or log.handlers instead of log.method.
  4. If a custom file target is desired, pass the filename directly as log.method value.

Example fix

// before
Properties props = new Properties();
props.setProperty("log.method", "syslog");
RedwoodConfiguration.applyProperties(props);
// after
props.setProperty("log.method", "stderr"); // or stdout / java.util.logging / a file path
Defensive patterns

Strategy: validation

Validate before calling

Set<String> valid = new HashSet<>(Arrays.asList("stderr", "stdout", "java.util.logging"));
String method = props.getProperty("log.method", "stderr");
if (!valid.contains(method.toLowerCase()) && !new File(method).getParentFile() != null /* treat as file path */) {
  throw new IllegalArgumentException("log.method must be stderr, stdout, java.util.logging, or a file path: " + method);
}

Try / catch

try {
  RedwoodConfiguration.applyProperties(props);
} catch (IllegalArgumentException e) {
  if (e.getMessage().contains("Unknown value for log.method")) {
    props.setProperty("log.method", "stderr");
    RedwoodConfiguration.applyProperties(props);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling RedwoodConfiguration.class.applyProperties(Properties) (or setupLog only via apply) with log.method set to something other than stderr, stdout, a filename, or java.util.logging, e.g. log.method=syslog or a misspelled value.

Common situations: Typo in a Stanford CoreNLP -log.method style property; copying config from another logging framework (log4j, slf4j as a method value); expecting 'slf4j' to be a valid log.method when SLF4J is only reachable via Handlers.slf4j.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/c5679e3e99e35c89. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/util/logging/RedwoodConfiguration.java:136

  /**
   * Determine where, in the end, console output should go.
   * The default is stdout.
   *
   * @param method An output, one of: stdout, stderr, or java.util.logging
   * @return this
   */
  public RedwoodConfiguration output(final String method) {
    if (method.equalsIgnoreCase("stdout") || method.equalsIgnoreCase("out")){
      edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt();
      this.outputHandler = Redwood.ConsoleHandler.out();
    } else if (method.equalsIgnoreCase("stderr") || method.equalsIgnoreCase("err")) {
        edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt();
        this.outputHandler = Redwood.ConsoleHandler.err();
    } else if (method.equalsIgnoreCase("java.util.logging")){
      edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt();
      this.outputHandler = RedirectOutputHandler.fromJavaUtilLogging(Logger.getLogger("``error``"));
    } else {
      throw new IllegalArgumentException("Unknown value for log.method");
    }
    return this;
  }

  /**
   * Set the width of the channels (or 0 to not show channels).
   * @param width The left margin in which to show channels
   * @return this
   */
  public RedwoodConfiguration channelWidth(final int width) {
    tasks.addFirst(() -> RedwoodConfiguration.this.channelWidth = width);
    return this;
  }

  /**
   * Clear any custom configurations to Redwood
   * @return this
   */

View on GitHub (pinned to 1b7edd19c4)