Cloud Manager code quality · Java code rules (SonarQube) · updated
CQBP-44 logging rules (seven variants)
CQBP-44 is a family of seven minor logging rules that Cloud Manager reports separately, from 'log or throw, not both' to 'no System.out'. Each fix is mechanical: log once, at WARN or ERROR in catch blocks, with your own message first and the exception last, through SLF4J.
| Rule keys | CQRules:CQBP-44—CatchAndEitherLogOrThrow, CQRules:CQBP-44—ConsecutivelyLogAndThrow, CQRules:CQBP-44—LogInfoInGetOrHeadRequests, CQRules:CQBP-44—ExceptionGetMessageIsFirstLogParam, CQRules:CQBP-44—WrongLogLevelInCatchBlock, CQRules:CQBP-44—ExceptionPrintStackTrace, CQRules:CQBP-44—LogLevelConsolePrinters |
|---|---|
| Adobe's rule name | CQBP-44 logging rules (seven variants) |
| Type | Code Smell |
| Severity | Minor |
| Since | 2018.4.0 |
| Checked by | SonarQube analysis of your Java code |
Why Cloud Manager flags it
These rules matter more on Cloud Service than they did on AEM 6.5. Logs are shipped from every pod to Cloud Manager and to any log forwarding you set up, so noise costs money and hides real errors, and you cannot just grep a file on the server. A single exception that is both logged and rethrown typically appears two or three times in the logs with different stack depths.
The seven variants
| Variant | Flags | Fix |
|---|---|---|
| CatchAndEitherLogOrThrow | Logging an exception and then rethrowing it | Either log it, or wrap it in your own exception and throw |
| ConsecutivelyLogAndThrow | log.error(msg) followed directly by throw new X(msg) | Throw only; let the catcher log |
| LogInfoInGetOrHeadRequests | log.info inside doGet/doHead | Use log.debug (per-request access logging is excluded) |
| ExceptionGetMessageIsFirstLogParam | log.error(e.getMessage(), e) | Write your own message: log.error("Unable to load {}", path, e) |
| WrongLogLevelInCatchBlock | DEBUG or INFO logging in a catch block | Log at WARN or ERROR |
| ExceptionPrintStackTrace | e.printStackTrace() | log.error("message", e) |
| LogLevelConsolePrinters | System.out / System.err | An SLF4J logger |
Adobe lists LogInfoInGetOrHeadRequests without a 'since' version; the other six are from 2018.4.0. All seven are Minor code smells.
Example
Non-compliant: three variants in five lines
} catch (RepositoryException e) {
log.debug(e.getMessage(), e); // wrong level, getMessage first
e.printStackTrace(); // printStackTrace
throw new RuntimeException(e); // logged and thrown
}Compliant
} catch (RepositoryException e) {
throw new ContentLoadException("Unable to load teaser at " + path, e);
}
// at the boundary that handles it:
} catch (ContentLoadException e) {
log.error("Teaser skipped on {}", pagePath, e);
}How to fix it
- Decide where each exception is handled (usually the servlet, model or job boundary) and log only there.
- Use a static SLF4J logger per class; remove System.out, System.err and printStackTrace with a search-and-replace review.
- Put the exception as the last argument so SLF4J prints the stack trace, and write a message that names the resource involved.
- Move per-request INFO lines in doGet to DEBUG; keep INFO for start-up, configuration changes and job summaries.
Does it stop the pipeline?
Code smells feed the Maintainability Rating, which is based on the total estimated fix time as a share of development time, not on any single finding. One finding rarely moves it, but hundreds can push the rating below A, which is an important failure: the pipeline pauses until someone overrides or fixes it.
If a finding is a genuine false positive, Adobe's code quality page lets you annotate the code with @SuppressWarnings and the rule ID. In a full-stack pipeline, important failures can be overridden by a deployment manager, project manager or business lead; in a code-quality-only pipeline they cannot.
Questions
Are CQBP-44 findings going to fail my pipeline?
Not one by one: they are minor code smells. Hundreds of them add to the remediation cost behind the Maintainability Rating, which pauses the pipeline when it falls below A.
Can these be fixed automatically?
Mostly yes. They are syntactic patterns; our agents prepare such changes as pull requests and an engineer reviews them, because choosing where to log needs judgement.
Why is getMessage() as the first parameter bad?
The message is often null or repeats the exception text, so the log line says nothing about what your code was doing. Your own message plus the exception gives both.
See the Cloud Service blockers in your code before Cloud Manager shows them. The free Surge Migrate readiness scan reads a repository zip or a Best Practices Analyzer CSV in your browser and lists them with file, fix and effort. Nothing is uploaded.
Sources
- Adobe: Custom code quality rules (checked 10 Nov 2026)
- Adobe: Code quality testing in Cloud Manager (checked 10 Nov 2026)
Rule key, type, severity and version are as listed on Adobe's page, checked 10 Nov 2026. Explanations and examples are ours unless marked as Adobe's.