bumptech/glide · error · IllegalArgumentException
Log level must be one of Log.VERBOSE, Log.DEBUG, Log.INFO, L
Error message
Log level must be one of Log.VERBOSE, Log.DEBUG, Log.INFO, Log.WARN, or Log.ERROR
What it means
Thrown by GlideBuilder.setLogLevel() when the supplied log level is outside the inclusive range [Log.VERBOSE, Log.ERROR]. Glide only accepts Android's standard log-level constants so that logging behavior is well-defined.
Source
Thrown at library/src/main/java/com/bumptech/glide/GlideBuilder.java:359
* exceptional cases will be logged.
*
* <p>All logs will be logged using the 'Glide' tag.
*
* <p>Many other debugging logs are available in individual classes. The log level supplied here
* only controls a small set of informative and well formatted logs. Users wishing to debug
* certain aspects of the library can look for individual <code>TAG</code> variables at the tops
* of classes and use <code>adb shell setprop log.tag.TAG</code> to enable or disable any relevant
* tags.
*
* @param logLevel The log level to use from {@link Log}.
* @return This builder.
*/
// Public API.
@SuppressWarnings("unused")
@NonNull
public GlideBuilder setLogLevel(int logLevel) {
if (logLevel < Log.VERBOSE || logLevel > Log.ERROR) {
throw new IllegalArgumentException(
"Log level must be one of Log.VERBOSE, Log.DEBUG," + " Log.INFO, Log.WARN, or Log.ERROR");
}
this.logLevel = logLevel;
return this;
}
/**
* If set to {@code true}, allows Glide to re-capture resources that are loaded into {@link
* com.bumptech.glide.request.target.Target}s which are subsequently de-referenced and garbage
* collected without being cleared.
*
* <p>Defaults to {@code false}.
*
* <p>Glide's resource re-use system is permissive, which means that's acceptable for callers to
* load resources into {@link com.bumptech.glide.request.target.Target}s and then never clear the
* {@link com.bumptech.glide.request.target.Target}. To do so, Glide uses {@link
* java.lang.ref.WeakReference}s to track resources that belong to {@link
* com.bumptech.glide.request.target.Target}s that haven't yet been cleared. Setting this methodView on GitHub (pinned to eb14a895d8)
Solutions
- Pass one of the explicit constants: Log.VERBOSE, Log.DEBUG, Log.INFO, Log.WARN, or Log.ERROR.
- Validate any externally-sourced log level against the allowed range before calling setLogLevel.
- Default to Log.WARN when the value is unknown instead of forwarding an invalid one.
- Centralize log-level configuration behind a helper that constrains inputs.
Example fix
// before Glide.init(this, GlideBuilder().setLogLevel(0)) // 0 is VERBOSE, but a bad source may pass -5 // after val safeLevel = rawLevel.coerceIn(Log.VERBOSE, Log.ERROR) Glide.init(this, GlideBuilder().setLogLevel(safeLevel))
Defensive patterns
Strategy: validation
Validate before calling
// Clamp externally sourced levels to the valid range before use. fun safeLogLevel(raw: Int): Int = raw.coerceIn(Log.VERBOSE, Log.ERROR) Glide.init(this, GlideBuilder().setLogLevel(safeLogLevel(configLevel)))
Prevention
- Only pass explicit Log constants to setLogLevel.
- Validate/remote-config values against [Log.VERBOSE, Log.ERROR].
- Default to Log.WARN when the level is unknown.
When it happens
Trigger: setLogLevel(logLevel) is called with logLevel < Log.VERBOSE or logLevel > Log.ERROR.
Common situations: Passing a made-up integer for the log level; reading a level from a remote-config/JSON value without validation; using an Android Log constant from a different API (e.g. a priority value); copy-paste of the wrong constant.
Related errors
- Failed to find image header parser.
- Glide has been called recursively, this is probably an inter
- GeneratedAppGlideModuleImpl is implemented incorrectly. If y
- Cannot register already registered manager
- Cannot unregister not yet registered manager
AI-assisted analysis of bumptech/glide@eb14a895d8 (2026-08-14).
Data as JSON: /api/errors/bece742cce4c8ce0.
Report an issue: GitHub.