karatelabs/karate · warning

configure 'logModifier' is removed; use the declarative…

Error message

configure 'logModifier' is removed; use the declarative form: 'configure logging = {{ mask: {{ headers: [...], jsonPaths: [...], patterns: [...] }} }}'

What it means

Karate v2 removed the `configure logModifier` option entirely (not merely deprecated). Masking of headers/fields/patterns is now declarative via `configure logging = { mask: { headers: [...], jsonPaths: [...], patterns: [...] } }`. Setting logModifier is a no-op that logs this warning with the replacement syntax.

Solutions

  1. Port the custom LogModifier's rules into `configure logging = { mask: { headers: [...], jsonPaths: [...], patterns: [...] } }`
  2. Delete the `configure logModifier` line and the custom LogModifier class if fully replaced
  3. Verify masking by running a request with sensitive headers and inspecting karate.log
  4. Update security/compliance docs describing log masking to the declarative v2 form

Example fix

// before
* configure logModifier = com.acme.MyLogModifier()
// after
* configure logging = { mask: { headers: ['Authorization'], patterns: ['"token":"[^"]+"'] } }
Defensive patterns

Strategy: validation

Validate before calling

grep -rn 'configure logModifier' karate-config.js features/ && echo 'removed configure key found'

Prevention

When it happens

Trigger: A feature or karate-config.js containing `configure logModifier = <custom LogModifier>` — the v1 programmatic masking hook — after upgrading to v2.

Common situations: v1→v2 migration where teams had custom LogModifier implementations to mask tokens/PII in logs; security-driven log redaction configs carried over unchanged.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of karatelabs/karate@a22eb90246 (2026-09-12). Data as JSON: /api/errors/3d84c23ef80e09cc. Report an issue: GitHub.

Appendix: source

Thrown at karate-core/src/main/java/io/karatelabs/core/KarateConfig.java:451

                this.driverConfig = value;
            }

            // Deprecated v1 options - no-op with one-line migration hint
            case "logPrettyRequest", "logPrettyResponse" -> {
                logger.warn("configure '{}' is deprecated; use 'configure logging = {{ pretty: true|false }}'", key);
            }
            case "printEnabled" -> {
                logger.warn("configure 'printEnabled' is deprecated; print/karate.log go to the 'karate.scenario' "
                        + "SLF4J category - set its level to WARN in logback.xml to keep them off the console, "
                        + "or 'configure logging = {{ console: \"warn\" }}' to quiet all karate console output");
            }
            case "lowerCaseResponseHeaders" -> {
                logger.warn("configure 'lowerCaseResponseHeaders' is deprecated; "
                        + "'match header X' is already case-insensitive and 'karate.lowerCase(responseHeaders)' "
                        + "covers direct map access");
            }
            case "logModifier" -> {
                logger.warn("configure 'logModifier' is removed; "
                        + "use the declarative form: 'configure logging = {{ mask: {{ headers: [...], jsonPaths: [...], patterns: [...] }} }}'");
            }

            // No channel-type cases: channels (grpc, kafka, …) are configured via their rich
            // JS object — karate.channel('kafka') / the boot.ext('kafka') object — not via global
            // 'configure <type>'. 'configure' stays strict so key typos fail loudly.
            default -> throw new RuntimeException("unexpected 'configure' key: '" + key + "'");
        }
    }

    private void configureSsl(Object value) {
        if (value == null) {
            this.ssl.clear();
            return;
        }
        if (value instanceof Boolean b) {
            this.ssl.clear();
            this.ssl.put("enabled", b);

View on GitHub (pinned to a22eb90246)