{"record":{"id":"1dbb683e43be7c3e","repo":"jenkinsci/jenkins","slug":"a-logger-named-0-does-not-exist-add-a-logger","errorCode":null,"errorMessage":"A logger named \"{0}\" does not exist. Add a logger by this name to a log recorder before attempting to configure its level.","messagePattern":"A logger named \"(.+?)\" does not exist\\. Add a logger by this name to a log recorder before attempting to configure its level\\.","errorType":"exception","errorClass":"Failure","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/hudson/logging/LogRecorderManager.java","lineNumber":224,"sourceCode":"    @RequirePOST\n    @SuppressFBWarnings(\n            value = \"LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE\",\n            justification =\n                    \"if the logger is known, then we have a reference to it in LogRecorder#loggers\")\n    public HttpResponse doConfigLogger(@QueryParameter String name, @QueryParameter String level) {\n        Jenkins.get().checkPermission(Jenkins.ADMINISTER);\n        Level lv;\n        if (level.equals(\"inherit\"))\n            lv = null;\n        else\n            lv = Level.parse(level.toUpperCase(Locale.ENGLISH));\n        Logger target;\n        if (Collections.list(LogManager.getLogManager().getLoggerNames()).contains(name)\n                && (target = Logger.getLogger(name)) != null) {\n            target.setLevel(lv);\n            return new HttpRedirect(\"levels\");\n        } else {\n            throw new Failure(Messages.LogRecorderManager_LoggerNotFound(name));\n        }\n    }\n\n    /**\n     * RSS feed for log entries.\n     */\n    public void doRss(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {\n        doRss(req, rsp, Jenkins.logRecords);\n    }\n\n    /**\n     * Renders the given log recorders as RSS.\n     */\n    /*package*/ static void doRss(StaplerRequest2 req, StaplerResponse2 rsp, List<LogRecord> logs) throws IOException, ServletException {\n        // filter log records based on the log level\n        String entryType = \"all\";\n        String level = req.getParameter(\"level\");\n        if (level != null) {","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/logging/LogRecorderManager.java#L206-L242","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the logger name exists: enumerate via LogManager.getLogManager().getLoggerNames() before submitting","Trigger the code path that creates the logger first (e.g. exercise the feature once) so the logger is registered","Check for typos or stale names in automation scripts and align with current class/package names","Add the logger to a log recorder in the Jenkins UI first, then set its level"],"exampleFix":"// before: submitting a level for a non-existent logger throws Failure\n// after: check existence first\nLogManager lm = LogManager.getLogManager();\nif (!Collections.list(lm.getLoggerNames()).contains(name)) {\n    return FormValidation.error(\"Logger \" + name + \" does not exist\");\n}\n// proceed to set level","handlingStrategy":"validation","validationCode":"LogManager lm = LogManager.getLogManager();\nif (!Collections.list(lm.getLoggerNames()).contains(name)) {\n    throw new IllegalArgumentException(\"Logger '\" + name + \"' is not registered in the JVM\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    // call the /log/levels endpoint or setLevel logic\n} catch (Failure f) {\n    if (f.getMessage().contains(\"does not exist\")) {\n        // logger name invalid; inform admin to correct it\n    }\n    throw f;\n}","preventionTips":["Validate logger names against LogManager.getLoggerNames() before configuring levels","In automation scripts, reference current class/package names, not stale ones","Trigger the feature once so lazy loggers are registered before configuration"],"tags":["logging","admin","stapler","validation","log-levels"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}