vy commented on code in PR #4063:
URL: https://github.com/apache/logging-log4j2/pull/4063#discussion_r2941057302
##########
src/site/antora/modules/ROOT/pages/manual/plugins.adoc:
##########
@@ -215,6 +215,39 @@ The `GraalVmProcessor` requires your project's `groupId`
and `artifactId` to cor
Provide these values to the processor using the `log4j.graalvm.groupId` and
`log4j.graalvm.artifactId` annotation processor options.
====
+.Suppressing notes from `PluginProcessor` in strict build environments
+[%collapsible]
+====
+Some build environments treat all compiler notes or warnings as errors (e.g.,
Maven with `-Werror` or Gradle with `options.compilerArgs << '-Werror'`).
+By default, `PluginProcessor` emits a `NOTE`-level diagnostic when it writes
the plugin descriptor, which can cause the build to fail in those environments.
+
Review Comment:
`To suppress these information notes` refers to the earlier phrase, hence
they should be in the same paragraph.
```suggestion
```
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java:
##########
@@ -78,15 +96,58 @@ public class PluginProcessor extends AbstractProcessor {
private final List<Element> processedElements = new ArrayList<>();
private final PluginCache pluginCache = new PluginCache();
+ private Diagnostic.Kind minAllowedMessageKind = Diagnostic.Kind.NOTE;
+
+ @Override
+ public void init(final ProcessingEnvironment processingEnv) {
+ super.init(processingEnv);
+ final String kindValue =
processingEnv.getOptions().get(MIN_ALLOWED_MESSAGE_KIND_OPTION);
+ if (kindValue != null) {
+ try {
+ minAllowedMessageKind =
Diagnostic.Kind.valueOf(kindValue.toUpperCase(Locale.ROOT));
+ } catch (final IllegalArgumentException e) {
+ processingEnv
+ .getMessager()
+ .printMessage(
+ Diagnostic.Kind.WARNING,
+ String.format(
+ "%s: unrecognized value `%s` for
option `%s`, using default `%s`. Valid values: %s",
+ PluginProcessor.class.getSimpleName(),
Review Comment:
Shouldn't we rather use some FQCN here? I doubt `PluginProcessor` name would
help much to users having trouble with this setting.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]