You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2020/02/15 22:59:07 UTC

[logging-log4j2] branch release-2.x updated: PluginProcessor should use Messager instead of writing to System.out

This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new 7f50c55  PluginProcessor should use Messager instead of writing to System.out
7f50c55 is described below

commit 7f50c55d42889544a7202500e5725409e05f7a46
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sat Feb 15 15:58:55 2020 -0700

    PluginProcessor should use Messager instead of writing to System.out
---
 .../log4j/core/config/plugins/processor/PluginProcessor.java      | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java
index 2f3b53f..023330f 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Messager;
 import javax.annotation.processing.RoundEnvironment;
 import javax.annotation.processing.SupportedAnnotationTypes;
 import javax.lang.model.SourceVersion;
@@ -67,16 +68,17 @@ public class PluginProcessor extends AbstractProcessor {
 
     @Override
     public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
-        System.out.println("Processing annotations");
+        Messager messager = processingEnv.getMessager();
+        messager.printMessage(Kind.NOTE, "Processing Log4j annotations");
         try {
             final Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(Plugin.class);
             if (elements.isEmpty()) {
-                System.out.println("No elements to process");
+                messager.printMessage(Kind.NOTE, "No elements to process");
                 return false;
             }
             collectPlugins(elements);
             writeCacheFile(elements.toArray(new Element[elements.size()]));
-            System.out.println("Annotations processed");
+            messager.printMessage(Kind.NOTE, "Annotations processed");
             return true;
         } catch (final IOException e) {
             e.printStackTrace();