{"record":{"id":"3d84c23ef80e09cc","repo":"karatelabs/karate","slug":"configure-logmodifier-is-removed-use-the-declarative-form","errorCode":null,"errorMessage":"configure 'logModifier' is removed; use the declarative form: 'configure logging = {{ mask: {{ headers: [...], jsonPaths: [...], patterns: [...] }} }}'","messagePattern":"configure 'logModifier' is removed; use the declarative form: 'configure logging = (.+?)\\} \\}\\}'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/core/KarateConfig.java","lineNumber":451,"sourceCode":"                this.driverConfig = value;\n            }\n\n            // Deprecated v1 options - no-op with one-line migration hint\n            case \"logPrettyRequest\", \"logPrettyResponse\" -> {\n                logger.warn(\"configure '{}' is deprecated; use 'configure logging = {{ pretty: true|false }}'\", key);\n            }\n            case \"printEnabled\" -> {\n                logger.warn(\"configure 'printEnabled' is deprecated; print/karate.log go to the 'karate.scenario' \"\n                        + \"SLF4J category - set its level to WARN in logback.xml to keep them off the console, \"\n                        + \"or 'configure logging = {{ console: \\\"warn\\\" }}' to quiet all karate console output\");\n            }\n            case \"lowerCaseResponseHeaders\" -> {\n                logger.warn(\"configure 'lowerCaseResponseHeaders' is deprecated; \"\n                        + \"'match header X' is already case-insensitive and 'karate.lowerCase(responseHeaders)' \"\n                        + \"covers direct map access\");\n            }\n            case \"logModifier\" -> {\n                logger.warn(\"configure 'logModifier' is removed; \"\n                        + \"use the declarative form: 'configure logging = {{ mask: {{ headers: [...], jsonPaths: [...], patterns: [...] }} }}'\");\n            }\n\n            // No channel-type cases: channels (grpc, kafka, …) are configured via their rich\n            // JS object — karate.channel('kafka') / the boot.ext('kafka') object — not via global\n            // 'configure <type>'. 'configure' stays strict so key typos fail loudly.\n            default -> throw new RuntimeException(\"unexpected 'configure' key: '\" + key + \"'\");\n        }\n    }\n\n    private void configureSsl(Object value) {\n        if (value == null) {\n            this.ssl.clear();\n            return;\n        }\n        if (value instanceof Boolean b) {\n            this.ssl.clear();\n            this.ssl.put(\"enabled\", b);","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/KarateConfig.java#L433-L469","documentation":"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.","triggerScenarios":"A feature or karate-config.js containing `configure logModifier = <custom LogModifier>` — the v1 programmatic masking hook — after upgrading to v2.","commonSituations":"v1→v2 migration where teams had custom LogModifier implementations to mask tokens/PII in logs; security-driven log redaction configs carried over unchanged.","solutions":["Port the custom LogModifier's rules into `configure logging = { mask: { headers: [...], jsonPaths: [...], patterns: [...] } }`","Delete the `configure logModifier` line and the custom LogModifier class if fully replaced","Verify masking by running a request with sensitive headers and inspecting karate.log","Update security/compliance docs describing log masking to the declarative v2 form"],"exampleFix":"// before\n* configure logModifier = com.acme.MyLogModifier()\n// after\n* configure logging = { mask: { headers: ['Authorization'], patterns: ['\"token\":\"[^\"]+\"'] } }","handlingStrategy":"validation","validationCode":"grep -rn 'configure logModifier' karate-config.js features/ && echo 'removed configure key found'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the declarative `configure logging = { mask: ... }` for all log masking","Translate custom LogModifier rules into headers/jsonPaths/patterns lists at migration time","Verify masking output in karate.log after every migration","Keep a migration checklist of removed v1 configure keys (logModifier, printEnabled, etc.)"],"tags":["deprecation","configuration","migration","log-masking"],"backgroundTag":"deprecated-api-usage","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-16T19:17:19.609Z"}