Table of contents
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/** * Log postgreSQLClientConfig. */ @SuppressWarnings("squid:S2068") // Suppress "Credentials should not be hard-coded" // "'password' detected in this expression". // False positive: Password is configurable, here we remove it from the log. private void logPostgresConfig() { if (! log.isInfoEnabled()) { return; } JsonObject passwordRedacted = postgreSQLClientConfig.copy(); passwordRedacted.put(PASSWORD, "..."); log.info("postgreSQLClientConfig = {}" +, passwordRedacted.encode()); } |
...
- All log messages must be created using log framework substitution mechanism.
- Complex log message parameters should be created lazily where possible
- Using Pattern Layout, pay attention to the conversion characters you use. See https://www.codejava.net/coding/common-conversion-patterns-for-log4js-patternlayout
...