Skip to content

Commit bb785ed

Browse files
committed
[MPMD-292] - PMD Log is not always integrated into maven log
1 parent 7b8005f commit bb785ed

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,13 @@ public abstract class AbstractPmdReport
232232
@Parameter( defaultValue = "true", property = "pmd.showPmdLog" )
233233
protected boolean showPmdLog = true;
234234

235+
/**
236+
* This holds a strong reference in case we configured the logger to
237+
* redirect to slf4j. See {@link #showPmdLog}. Without a strong reference,
238+
* the logger might be garbage collected and the redirect to slf4j is gone.
239+
*/
240+
private Logger julLogger;
241+
235242
/** The files that are being analyzed. */
236243
protected Map<File, PmdFileInfo> filesToProcess;
237244

@@ -576,7 +583,8 @@ protected void setupPmdLogging()
576583
logger.addHandler( handler );
577584
handler.setLevel( Level.ALL );
578585
logger.setLevel( Level.ALL );
579-
getLog().debug( "Configured jul-to-slf4j bridge for " + logger.getName() );
586+
julLogger = logger;
587+
julLogger.fine( "Configured jul-to-slf4j bridge for " + logger.getName() );
580588
}
581589

582590
static String getPmdVersion()

0 commit comments

Comments
 (0)