diff --git a/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/util/LoggingValidationHandler.java b/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/util/LoggingValidationHandler.java index 27167b6fa..104a072e5 100644 --- a/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/util/LoggingValidationHandler.java +++ b/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/util/LoggingValidationHandler.java @@ -53,8 +53,7 @@ public static LoggingValidationHandler instance() { * Get a singleton instance of the logging validation handler. * * @param logExceptions - * {@code true} if this instance will log exceptions or {@code false} - * otherwise + * {@code true} if this instance will log exceptions or {@code false} otherwise * @return the instance */ @SuppressFBWarnings(value = "SING_SINGLETON_GETTER_NOT_SYNCHRONIZED", @@ -148,8 +147,15 @@ private void handleXmlValidationFinding(XmlValidationFinding finding) { private void handleConstraintValidationFinding(@NonNull ConstraintValidationFinding finding) { Ansi ansi = generatePreamble(finding.getSeverity()); + ansi.format("[%s]", finding.getTarget().getMetapath()); + + String id = finding.getIdentifier(); + if (id != null) { + ansi.format(" %s: ", id); + } + getLogger(finding).log( - ansi.format("[%s] %s", finding.getTarget().getMetapath(), finding.getMessage())); + ansi.format(" %s", finding.getTarget().getMetapath(), finding.getMessage())); } @NonNull