SonarSource/sonarqube · error · IllegalArgumentException
log level is not supported (allowed levels are )
Error message
%s log level is not supported (allowed levels are %s)
What it means
ensureSupportedLevel validates a logback root Level against ALLOWED_ROOT_LOG_LEVELS before LogbackHelper.applyChangeToRootLogger applies it. Logback defines levels beyond the allowed subset (TRACE, ALL, and custom levels), so an out-of-subset level is rejected with an IllegalArgumentException instead of silently misconfiguring logging.
Solutions
- Use one of the allowed root levels only (typically TRACE, DEBUG, INFO, WARN, ERROR).
- If you want maximum verbosity, use TRACE rather than ALL.
- For per-logger configuration, ensure any property-configured level is also within the allow-list.
Example fix
// before changeRoot(Level.ALL); // after changeRoot(Level.TRACE);
Defensive patterns
Strategy: validation
Validate before calling
Set<String> allowed = Set.of("TRACE", "DEBUG", "INFO", "WARN", "ERROR");
String level = requested.toUpperCase(Locale.ROOT);
if (!allowed.contains(level)) throw new IllegalArgumentException("Unsupported level: " + level);
changeRoot(Level.toLevel(level)); Prevention
- Restrict level-switching UIs/scripts to TRACE..ERROR.
- Never send ALL or custom logback levels to the changeRoot API.
- Prefer per-logger config for fine-grained verbosity.
When it happens
Trigger: Calling changeRoot (directly or via the web API /admin/process logs or ws log level change) with a level such as ALL, TRACE, or a custom/invalid string parsed into a logback Level outside the allow-list.
Common situations: Attempting to enable TRACE/ALL debugging at runtime; a monitoring script POSTing an unsupported level name; property `sonar.log.level` mapped to a disallowed level.
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
- a JVM option can't be empty and must start with '-'. The…
- Address contains invalid character: 0x%02x
- allowAllGroups can only be enabled when Auto-provisioning…
- allowAllGroups cannot be enabled when the GitLab URL is…
- allowedGroups cannot be empty when Auto-provisioning is…
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/724a37f79145ba3f.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java:157
rootContext.getLogger(loggerName).setLevel(newLevel);
}
private static void applyHardUnlessTrace(LoggerContext rootContext, String logger, boolean traceGloballyEnabled) {
if (!traceGloballyEnabled) {
rootContext.getLogger(logger).setLevel(Level.OFF);
}
}
public void changeRoot(LogLevelConfig logLevelConfig, Level newLevel) {
ensureSupportedLevel(newLevel);
LoggerContext rootContext = getRootContext();
rootContext.getLogger(ROOT_LOGGER_NAME).setLevel(newLevel);
logLevelConfig.getConfiguredByProperties().forEach((key, value) -> rootContext.getLogger(key).setLevel(newLevel));
}
private static void ensureSupportedLevel(Level newLevel) {
if (!isAllowed(newLevel)) {
throw new IllegalArgumentException(format("%s log level is not supported (allowed levels are %s)", newLevel, Arrays.toString(ALLOWED_ROOT_LOG_LEVELS)));
}
}
/**
* Creates a new {@link ConsoleAppender} to {@code System.out} with the specified name and log encoder.
*/
public ConsoleAppender<ILoggingEvent> newConsoleAppender(Context loggerContext, String name, Encoder<ILoggingEvent> encoder) {
ConsoleAppender<ILoggingEvent> consoleAppender = new ConsoleAppender<>();
consoleAppender.setContext(loggerContext);
consoleAppender.setEncoder(encoder);
consoleAppender.setName(name);
consoleAppender.setTarget("System.out");
consoleAppender.start();
return consoleAppender;
}
/**
* Make logback configuration for a process to push all its logs to a log file.View on GitHub (pinned to 184c821202)