Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANSI escape codes not resolved/removed in o.e.m2e.logback.appender #1915

Open
kwin opened this issue Jan 13, 2025 · 2 comments
Open

ANSI escape codes not resolved/removed in o.e.m2e.logback.appender #1915

kwin opened this issue Jan 13, 2025 · 2 comments

Comments

@kwin
Copy link
Member

kwin commented Jan 13, 2025

When a Maven plugin leverages the API https://maven.apache.org/shared/maven-shared-utils/apidocs/org/apache/maven/shared/utils/logging/package-summary.html the error messages contain the ANSI escape codes in the Eclipse error.log

For example:

�[1mValidationViolation: �[mFound orphaned filter entries: includes [regex: /etc/acs-commons/jcr:content, regex: /etc/acs-commons/lists/font-awesome-icons/jcr:content/list, regex: /etc/acs-commons/lists/report-parameter-components/jcr:content/list/default_\d+, regex: /etc/acs-commons/exporters/tag-to-csv-exporter/jcr:content(/.*)?] below root '/etc/acs-commons', validator: �[1mjackrabbit-filter�[m

This is triggered through this plugin https://github.com/apache/jackrabbit-filevault-package-maven-plugin/blob/3187361093da5109058c3cc9529adacae4d3bb6a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ValidationMessagePrinter.java#L146.

m2e.logback.appender should either interpret ANSI escape characters or remove them prior emitting plain text.
This was probably introduced with https://bugs.eclipse.org/bugs/show_bug.cgi?id=536402 (ae8412f).

@kwin
Copy link
Member Author

kwin commented Jan 13, 2025

The following method is called from Maven to determine whether ANSI is supported or not: https://github.com/apache/maven-shared-utils/blob/8ea76b5ef2f770cd43f6d5d0e0e56d2c5ac47105/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L93.

This is called from https://github.com/apache/maven/blob/d4be73bb1ebe89314a683cb3c19230a6029b3c0d/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L483-L501.

The problem is that the same log message is being emitted twice in m2e:
In the Maven Console (for non-incremental builds, supports Color, https://eclipse.dev/eclipse/news/4.25/platform.html#debug-ansi-support), in the Workspace error log (via m2e.logback.appender). The latter does not support ANSI while the former does.

@kwin
Copy link
Member Author

kwin commented Jan 13, 2025

We probably need to remove ANSI codes in

IStatus status = new Status(severity, BUNDLE_ID, logEvent.getFormattedMessage().strip(), getThrowable(logEvent));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant