SonarSource/sonarqube · error · IllegalArgumentException
log level in property is not a supported value (allowed…
Error message
log level %s in property %s is not a supported value (allowed levels are %s)
What it means
AbstractLogHelper.getPropertyValueAsLevel reads a logging level property and converts it with Log4j Level.toLevel (defaulting to INFO when unparseable). If the resulting level is not among ALLOWED_ROOT_LOG_LEVELS, it throws IllegalArgumentException listing the allowed levels.
Solutions
- Set the property to one of the allowed levels: TRACE, DEBUG, INFO, WARN, ERROR.
- Replace unsupported synonyms (e.g. WARNING -> WARN, FATAL -> ERROR, VERBOSE -> DEBUG).
- Trim whitespace and check casing if the value looks correct but still rejected.
Example fix
// before sonar.log.level=warning // after sonar.log.level=WARN
Defensive patterns
Strategy: validation
Validate before calling
Set<String> ALLOWED = Set.of("TRACE", "DEBUG", "INFO", "WARN", "ERROR");
String lvl = props.value("sonar.log.level");
if (lvl != null && !ALLOWED.contains(lvl.trim().toUpperCase(Locale.ROOT))) {
throw new IllegalStateException("sonar.log.level must be one of " + ALLOWED + ", got: " + lvl);
} Try / catch
try {
Level level = logHelper.getPropertyValueAsLevel("sonar.log.level");
} catch (IllegalArgumentException e) {
logger.error("Invalid log level config: {}", e.getMessage());
// fall back to INFO
} Prevention
- Only use TRACE, DEBUG, INFO, WARN, ERROR for SonarQube log levels.
- Map other frameworks' level names before writing them into sonar.properties.
- Test log-level changes via the web admin UI, which validates values.
When it happens
Trigger: Setting sonar.log.level (or a per-process log level property like sonar.web.logLevel) to a value outside the allowed set (TRACE, DEBUG, INFO, WARN, ERROR), e.g. "verbose", "warning", or "FATAL".
Common situations: Users copying log level names from other frameworks (logback/Jul "warning", "fatal") into sonar.properties; mixed-case or padded values; changing log level at runtime via web API with a bad value.
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
- Fail to load the Logback configuration:
- Invalid value for property
- Logback configuration not found in classloader:
- Unknown type of SMTP secure connection:
- Unsupported value for property
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/87e69654a34fa2ac.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-process/src/main/java/org/sonar/process/logging/AbstractLogHelper.java:81
for (String propertyKey : propertyKeys) {
Level level = getPropertyValueAsLevel(props, propertyKey);
if (level != null) {
newLevel = level;
}
}
return newLevel;
}
@CheckForNull
static Level getPropertyValueAsLevel(Props props, String propertyKey) {
String value = props.value(propertyKey);
if (value == null) {
return null;
}
Level level = Level.toLevel(value, Level.INFO);
if (!isAllowed(level)) {
throw new IllegalArgumentException(format("log level %s in property %s is not a supported value (allowed levels are %s)",
level, propertyKey, Arrays.toString(ALLOWED_ROOT_LOG_LEVELS)));
}
return level;
}
static boolean isAllowed(Level level) {
for (Level allowedRootLogLevel : ALLOWED_ROOT_LOG_LEVELS) {
if (level.equals(allowedRootLogLevel)) {
return true;
}
}
return false;
}
}
View on GitHub (pinned to 184c821202)