{"record":{"id":"c5679e3e99e35c89","repo":"stanfordnlp/CoreNLP","slug":"unknown-value-for-log-method","errorCode":null,"errorMessage":"Unknown value for log.method","messagePattern":"Unknown value for log\\.method","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/util/logging/RedwoodConfiguration.java","lineNumber":136,"sourceCode":"  /**\n   * Determine where, in the end, console output should go.\n   * The default is stdout.\n   *\n   * @param method An output, one of: stdout, stderr, or java.util.logging\n   * @return this\n   */\n  public RedwoodConfiguration output(final String method) {\n    if (method.equalsIgnoreCase(\"stdout\") || method.equalsIgnoreCase(\"out\")){\n      edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt();\n      this.outputHandler = Redwood.ConsoleHandler.out();\n    } else if (method.equalsIgnoreCase(\"stderr\") || method.equalsIgnoreCase(\"err\")) {\n        edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt();\n        this.outputHandler = Redwood.ConsoleHandler.err();\n    } else if (method.equalsIgnoreCase(\"java.util.logging\")){\n      edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt();\n      this.outputHandler = RedirectOutputHandler.fromJavaUtilLogging(Logger.getLogger(\"``error``\"));\n    } else {\n      throw new IllegalArgumentException(\"Unknown value for log.method\");\n    }\n    return this;\n  }\n\n  /**\n   * Set the width of the channels (or 0 to not show channels).\n   * @param width The left margin in which to show channels\n   * @return this\n   */\n  public RedwoodConfiguration channelWidth(final int width) {\n    tasks.addFirst(() -> RedwoodConfiguration.this.channelWidth = width);\n    return this;\n  }\n\n  /**\n   * Clear any custom configurations to Redwood\n   * @return this\n   */","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/util/logging/RedwoodConfiguration.java#L118-L154","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set log.method to one of: stderr, stdout, java.util.logging, or a file path.","Check spelling/case: the comparison is case-insensitive equalsIgnoreCase, so fix the value text, not capitalization.","To route through SLF4J, build the configuration programmatically with RedwoodConfiguration.empty().handlers(...) or log.handlers instead of log.method.","If a custom file target is desired, pass the filename directly as log.method value."],"exampleFix":"// before\nProperties props = new Properties();\nprops.setProperty(\"log.method\", \"syslog\");\nRedwoodConfiguration.applyProperties(props);\n// after\nprops.setProperty(\"log.method\", \"stderr\"); // or stdout / java.util.logging / a file path","handlingStrategy":"validation","validationCode":"Set<String> valid = new HashSet<>(Arrays.asList(\"stderr\", \"stdout\", \"java.util.logging\"));\nString method = props.getProperty(\"log.method\", \"stderr\");\nif (!valid.contains(method.toLowerCase()) && !new File(method).getParentFile() != null /* treat as file path */) {\n  throw new IllegalArgumentException(\"log.method must be stderr, stdout, java.util.logging, or a file path: \" + method);\n}","typeGuard":null,"tryCatchPattern":"try {\n  RedwoodConfiguration.applyProperties(props);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Unknown value for log.method\")) {\n    props.setProperty(\"log.method\", \"stderr\");\n    RedwoodConfiguration.applyProperties(props);\n  } else throw e;\n}","preventionTips":["Keep a whitelist constant of allowed log.method values in your config loader.","Validate all log.* properties before calling applyProperties.","Remember file paths are also accepted — validate those too before assuming a typo."],"tags":["logging","configuration","illegal-argument","corenlp"],"backgroundTag":"invalid-enum-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}