This is an automated email from the ASF dual-hosted git repository. adangel pushed a commit to branch MPMD-292 in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
commit 3fdecdbf2ec3b7da1eb54fbd4c792d3141d9ec6c Author: Andreas Dangel <adan...@apache.org> AuthorDate: Thu Aug 1 20:31:00 2019 +0200 [MPMD-292] - PMD Log is not always integrated into maven log --- .../java/org/apache/maven/plugins/pmd/AbstractPmdReport.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java b/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java index 53a6da2..4cadbcd 100644 --- a/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java +++ b/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java @@ -232,6 +232,13 @@ public abstract class AbstractPmdReport @Parameter( defaultValue = "true", property = "pmd.showPmdLog" ) protected boolean showPmdLog = true; + /** + * This holds a strong reference in case we configured the logger to + * redirect to slf4j. See {@link #showPmdLog}. Without a strong reference, + * the logger might be garbage collected and the redirect to slf4j is gone. + */ + private Logger julLogger; + /** The files that are being analyzed. */ protected Map<File, PmdFileInfo> filesToProcess; @@ -576,7 +583,8 @@ public abstract class AbstractPmdReport logger.addHandler( handler ); handler.setLevel( Level.ALL ); logger.setLevel( Level.ALL ); - getLog().debug( "Configured jul-to-slf4j bridge for " + logger.getName() ); + julLogger = logger; + julLogger.fine( "Configured jul-to-slf4j bridge for " + logger.getName() ); } static String getPmdVersion()