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 keysCQRules: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 nameCQBP-44 logging rules (seven variants)
TypeCode Smell
SeverityMinor
Since2018.4.0
Checked bySonarQube 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

VariantFlagsFix
CatchAndEitherLogOrThrowLogging an exception and then rethrowing itEither log it, or wrap it in your own exception and throw
ConsecutivelyLogAndThrowlog.error(msg) followed directly by throw new X(msg)Throw only; let the catcher log
LogInfoInGetOrHeadRequestslog.info inside doGet/doHeadUse log.debug (per-request access logging is excluded)
ExceptionGetMessageIsFirstLogParamlog.error(e.getMessage(), e)Write your own message: log.error("Unable to load {}", path, e)
WrongLogLevelInCatchBlockDEBUG or INFO logging in a catch blockLog at WARN or ERROR
ExceptionPrintStackTracee.printStackTrace()log.error("message", e)
LogLevelConsolePrintersSystem.out / System.errAn 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

  1. Decide where each exception is handled (usually the servlet, model or job boundary) and log only there.
  2. Use a static SLF4J logger per class; remove System.out, System.err and printStackTrace with a search-and-replace review.
  3. Put the exception as the last argument so SLF4J prints the stack trace, and write a message that names the resource involved.
  4. 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

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.

Scan, Convert, Verify, Install

How Surge Migrate helps with a move to AEM as a Cloud Service

Surge Migrate moves a website from any CMS to any CMS, and AEM as a Cloud Service is one of the systems it writes. Pages are converted automatically, and you check the result before you install anything.

  1. 1

    Scan

    Names the system behind your site, counts pages and templates, lists the blocks to build and the work no tool does, and gives an effort range with its working.

    Scan a site →
  2. 2

    Convert

    Each page becomes an Edge Delivery document, an AEM Core Component page and import files for 7 other systems. 10 pages free; 500 or 2,000 pages in one paid run.

    Convert your pages →
  3. 3

    Verify

    A download is offered only when its own format check passes. The report lists every field not found and every component kept as plain content. Compare old and new pages side by side.

    Parity check →
  4. 4

    Install

    You import with the target system's own tool, on your own environment. Each download's README gives the command. Your system changes only when you run it.

    How each import was tested →

Content packages installed on a local AEM as a Cloud Service SDK. See the worked examples.

On AEM 6.5 code: Scan AEM 6.5 code free. The scan reads a repository zip or a Best Practices Analyzer CSV in your browser and lists Cloud Service blockers with file, fix and effort. Nothing is uploaded.