{"record":{"id":"bece742cce4c8ce0","repo":"bumptech/glide","slug":"log-level-must-be-one-of-log-verbose-log-debug-l","errorCode":null,"errorMessage":"Log level must be one of Log.VERBOSE, Log.DEBUG, Log.INFO, Log.WARN, or Log.ERROR","messagePattern":"Log level must be one of Log\\.VERBOSE, Log\\.DEBUG, Log\\.INFO, Log\\.WARN, or Log\\.ERROR","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"library/src/main/java/com/bumptech/glide/GlideBuilder.java","lineNumber":359,"sourceCode":"   * exceptional cases will be logged.\n   *\n   * <p>All logs will be logged using the 'Glide' tag.\n   *\n   * <p>Many other debugging logs are available in individual classes. The log level supplied here\n   * only controls a small set of informative and well formatted logs. Users wishing to debug\n   * certain aspects of the library can look for individual <code>TAG</code> variables at the tops\n   * of classes and use <code>adb shell setprop log.tag.TAG</code> to enable or disable any relevant\n   * tags.\n   *\n   * @param logLevel The log level to use from {@link Log}.\n   * @return This builder.\n   */\n  // Public API.\n  @SuppressWarnings(\"unused\")\n  @NonNull\n  public GlideBuilder setLogLevel(int logLevel) {\n    if (logLevel < Log.VERBOSE || logLevel > Log.ERROR) {\n      throw new IllegalArgumentException(\n          \"Log level must be one of Log.VERBOSE, Log.DEBUG,\" + \" Log.INFO, Log.WARN, or Log.ERROR\");\n    }\n    this.logLevel = logLevel;\n    return this;\n  }\n\n  /**\n   * If set to {@code true}, allows Glide to re-capture resources that are loaded into {@link\n   * com.bumptech.glide.request.target.Target}s which are subsequently de-referenced and garbage\n   * collected without being cleared.\n   *\n   * <p>Defaults to {@code false}.\n   *\n   * <p>Glide's resource re-use system is permissive, which means that's acceptable for callers to\n   * load resources into {@link com.bumptech.glide.request.target.Target}s and then never clear the\n   * {@link com.bumptech.glide.request.target.Target}. To do so, Glide uses {@link\n   * java.lang.ref.WeakReference}s to track resources that belong to {@link\n   * com.bumptech.glide.request.target.Target}s that haven't yet been cleared. Setting this method","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/bumptech/glide/blob/eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a/library/src/main/java/com/bumptech/glide/GlideBuilder.java#L341-L377","documentation":"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.","triggerScenarios":"setLogLevel(logLevel) is called with logLevel < Log.VERBOSE or logLevel > Log.ERROR.","commonSituations":"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.","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."],"exampleFix":"// before\nGlide.init(this, GlideBuilder().setLogLevel(0)) // 0 is VERBOSE, but a bad source may pass -5\n\n// after\nval safeLevel = rawLevel.coerceIn(Log.VERBOSE, Log.ERROR)\nGlide.init(this, GlideBuilder().setLogLevel(safeLevel))","handlingStrategy":"validation","validationCode":"// Clamp externally sourced levels to the valid range before use.\nfun safeLogLevel(raw: Int): Int = raw.coerceIn(Log.VERBOSE, Log.ERROR)\n\nGlide.init(this, GlideBuilder().setLogLevel(safeLogLevel(configLevel)))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["glide-core","configuration","logging","validation","runtime"],"backgroundTag":null,"analyzedSha":"eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a","analyzedAt":"2026-08-14T01:43:54.821Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}