jenkinsci/jenkins · warning · Failure

A logger named "{0}" does not exist. Add a logger by this na

Error message

A logger named "{0}" does not exist. Add a logger by this name to a log recorder before attempting to configure its level.

What it means

Thrown by LogRecorderManager.doLevels (the log level configuration endpoint) when the caller POSTs a level for a logger name that does not exist in the JVM's LogManager. The code checks Collections.list(LogManager.getLogManager().getLoggerNames()).contains(name); if the name is absent, it throws a Stapler Failure with the localized 'LoggerNotFound' message. Requires Jenkins.ADMINISTER permission (checked above).

Source

Thrown at core/src/main/java/hudson/logging/LogRecorderManager.java:224

    @RequirePOST
    @SuppressFBWarnings(
            value = "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE",
            justification =
                    "if the logger is known, then we have a reference to it in LogRecorder#loggers")
    public HttpResponse doConfigLogger(@QueryParameter String name, @QueryParameter String level) {
        Jenkins.get().checkPermission(Jenkins.ADMINISTER);
        Level lv;
        if (level.equals("inherit"))
            lv = null;
        else
            lv = Level.parse(level.toUpperCase(Locale.ENGLISH));
        Logger target;
        if (Collections.list(LogManager.getLogManager().getLoggerNames()).contains(name)
                && (target = Logger.getLogger(name)) != null) {
            target.setLevel(lv);
            return new HttpRedirect("levels");
        } else {
            throw new Failure(Messages.LogRecorderManager_LoggerNotFound(name));
        }
    }

    /**
     * RSS feed for log entries.
     */
    public void doRss(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
        doRss(req, rsp, Jenkins.logRecords);
    }

    /**
     * Renders the given log recorders as RSS.
     */
    /*package*/ static void doRss(StaplerRequest2 req, StaplerResponse2 rsp, List<LogRecord> logs) throws IOException, ServletException {
        // filter log records based on the log level
        String entryType = "all";
        String level = req.getParameter("level");
        if (level != null) {

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. Verify the logger name exists: enumerate via LogManager.getLogManager().getLoggerNames() before submitting
  2. Trigger the code path that creates the logger first (e.g. exercise the feature once) so the logger is registered
  3. Check for typos or stale names in automation scripts and align with current class/package names
  4. Add the logger to a log recorder in the Jenkins UI first, then set its level

Example fix

// before: submitting a level for a non-existent logger throws Failure
// after: check existence first
LogManager lm = LogManager.getLogManager();
if (!Collections.list(lm.getLoggerNames()).contains(name)) {
    return FormValidation.error("Logger " + name + " does not exist");
}
// proceed to set level
Defensive patterns

Strategy: validation

Validate before calling

LogManager lm = LogManager.getLogManager();
if (!Collections.list(lm.getLoggerNames()).contains(name)) {
    throw new IllegalArgumentException("Logger '" + name + "' is not registered in the JVM");
}

Try / catch

try {
    // call the /log/levels endpoint or setLevel logic
} catch (Failure f) {
    if (f.getMessage().contains("does not exist")) {
        // logger name invalid; inform admin to correct it
    }
    throw f;
}

Prevention

When it happens

Trigger: An admin user or script calls the /log/levels endpoint with a logger name that has never been instantiated via Logger.getLogger(name). The name may be misspelled, refer to a logger only created lazily, or belong to a plugin not yet loaded.

Common situations: Typo in the logger name when configuring levels via the UI or CLI; targeting a logger from a plugin that is not yet installed or not yet loaded; referencing a logger that is only created after the first log call of a class; REST/automation scripts using stale logger names after a rename.

Related errors


AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14). Data as JSON: /api/errors/1dbb683e43be7c3e. Report an issue: GitHub.