[cli] Remove unnecessary logging
This commit is contained in:
@ -44,6 +44,10 @@ public final class PmdRootLogger {
|
|||||||
// need to reload the logger with the new configuration
|
// need to reload the logger with the new configuration
|
||||||
log = LoggerFactory.getLogger(PMD_CLI_LOGGER);
|
log = LoggerFactory.getLogger(PMD_CLI_LOGGER);
|
||||||
resetLogLevel = true;
|
resetLogLevel = true;
|
||||||
|
|
||||||
|
// logging, mostly for testing purposes
|
||||||
|
Level defaultLogLevel = Slf4jSimpleConfiguration.getDefaultLogLevel();
|
||||||
|
log.debug("Log level is at {}", defaultLogLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
PmdReporter pmdReporter = setupMessageReporter();
|
PmdReporter pmdReporter = setupMessageReporter();
|
||||||
@ -68,9 +72,6 @@ public final class PmdRootLogger {
|
|||||||
PmdReporter pmdReporter = new SimpleMessageReporter(log);
|
PmdReporter pmdReporter = new SimpleMessageReporter(log);
|
||||||
// always install java.util.logging to slf4j bridge
|
// always install java.util.logging to slf4j bridge
|
||||||
Slf4jSimpleConfiguration.installJulBridge();
|
Slf4jSimpleConfiguration.installJulBridge();
|
||||||
// logging, mostly for testing purposes
|
|
||||||
Level defaultLogLevel = Slf4jSimpleConfiguration.getDefaultLogLevel();
|
|
||||||
log.info("Log level is at {}", defaultLogLevel);
|
|
||||||
return pmdReporter;
|
return pmdReporter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import static org.hamcrest.CoreMatchers.startsWith;
|
|||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.emptyString;
|
import static org.hamcrest.Matchers.emptyString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
import static org.hamcrest.Matchers.not;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -90,7 +91,7 @@ class CpdCliTest extends BaseCliTest {
|
|||||||
@Test
|
@Test
|
||||||
void debugLogging() throws Exception {
|
void debugLogging() throws Exception {
|
||||||
CliExecutionResult result = runCliSuccessfully("--debug", "--minimum-tokens", "340", "--dir", SRC_DIR);
|
CliExecutionResult result = runCliSuccessfully("--debug", "--minimum-tokens", "340", "--dir", SRC_DIR);
|
||||||
result.checkStdErr(containsString("[main] INFO net.sourceforge.pmd.cli - Log level is at TRACE"));
|
result.checkStdErr(containsString("[DEBUG] Log level is at TRACE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -102,7 +103,7 @@ class CpdCliTest extends BaseCliTest {
|
|||||||
@Test
|
@Test
|
||||||
void defaultLogging() throws Exception {
|
void defaultLogging() throws Exception {
|
||||||
CliExecutionResult result = runCliSuccessfully("--minimum-tokens", "340", "--dir", SRC_DIR);
|
CliExecutionResult result = runCliSuccessfully("--minimum-tokens", "340", "--dir", SRC_DIR);
|
||||||
result.checkStdErr(containsString("[main] INFO net.sourceforge.pmd.cli - Log level is at INFO"));
|
result.checkStdErr(not(containsString("[DEBUG] Log level is at TRACE")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -199,14 +199,13 @@ class PmdCliTest extends BaseCliTest {
|
|||||||
@Test
|
@Test
|
||||||
void debugLogging() throws Exception {
|
void debugLogging() throws Exception {
|
||||||
CliExecutionResult result = runCliSuccessfully("--debug", "--dir", srcDir.toString(), "--rulesets", RULESET_NO_VIOLATIONS);
|
CliExecutionResult result = runCliSuccessfully("--debug", "--dir", srcDir.toString(), "--rulesets", RULESET_NO_VIOLATIONS);
|
||||||
result.checkStdErr(containsString("[main] INFO net.sourceforge.pmd.cli - Log level is at TRACE"));
|
result.checkStdErr(containsString("[DEBUG] Log level is at TRACE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void defaultLogging() throws Exception {
|
void defaultLogging() throws Exception {
|
||||||
CliExecutionResult result = runCliSuccessfully("--dir", srcDir.toString(), "--rulesets", RULESET_NO_VIOLATIONS);
|
CliExecutionResult result = runCliSuccessfully("--dir", srcDir.toString(), "--rulesets", RULESET_NO_VIOLATIONS);
|
||||||
result.checkStdErr(containsString("[main] INFO net.sourceforge.pmd.cli - Log level is at INFO"));
|
result.checkStdErr(not(containsString("[DEBUG] Log level is at TRACE")));
|
||||||
result.checkStdErr(not(containsPattern("Adding file .*"))); // not in debug mode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
org.slf4j.simpleLogger.logFile=System.err
|
org.slf4j.simpleLogger.logFile=System.err
|
||||||
org.slf4j.simpleLogger.showDateTime=false
|
org.slf4j.simpleLogger.showDateTime=false
|
||||||
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSSXXX
|
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSSXXX
|
||||||
org.slf4j.simpleLogger.showThreadName=true
|
org.slf4j.simpleLogger.showThreadName=false
|
||||||
org.slf4j.simpleLogger.showThreadId=false
|
org.slf4j.simpleLogger.showThreadId=false
|
||||||
org.slf4j.simpleLogger.showLogName=true
|
org.slf4j.simpleLogger.showLogName=false
|
||||||
org.slf4j.simpleLogger.showShortLogName=false
|
org.slf4j.simpleLogger.showShortLogName=false
|
||||||
org.slf4j.simpleLogger.levelInBrackets=false
|
org.slf4j.simpleLogger.levelInBrackets=true
|
||||||
|
|
||||||
# Default log level for all loggers
|
# Default log level for all loggers
|
||||||
# Must be one of "trace", "debug", "info", "warn", "error" or "off"
|
# Must be one of "trace", "debug", "info", "warn", "error" or "off"
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
org.slf4j.simpleLogger.logFile=System.err
|
org.slf4j.simpleLogger.logFile=System.err
|
||||||
org.slf4j.simpleLogger.showDateTime=false
|
org.slf4j.simpleLogger.showDateTime=false
|
||||||
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSSXXX
|
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSSXXX
|
||||||
org.slf4j.simpleLogger.showThreadName=true
|
org.slf4j.simpleLogger.showThreadName=false
|
||||||
org.slf4j.simpleLogger.showThreadId=false
|
org.slf4j.simpleLogger.showThreadId=false
|
||||||
org.slf4j.simpleLogger.showLogName=true
|
org.slf4j.simpleLogger.showLogName=false
|
||||||
org.slf4j.simpleLogger.showShortLogName=false
|
org.slf4j.simpleLogger.showShortLogName=false
|
||||||
org.slf4j.simpleLogger.levelInBrackets=false
|
org.slf4j.simpleLogger.levelInBrackets=true
|
||||||
|
|
||||||
# Default log level for all loggers
|
# Default log level for all loggers
|
||||||
# Must be one of "trace", "debug", "info", "warn", "error" or "off"
|
# Must be one of "trace", "debug", "info", "warn", "error" or "off"
|
||||||
|
@ -171,13 +171,13 @@ class BinaryDistributionIT extends AbstractBinaryDistributionTest {
|
|||||||
|
|
||||||
result = PMDExecutor.runPMD(createTemporaryReportFile(), tempDir, "-d", srcDir, "-R", "src/test/resources/rulesets/sample-ruleset.xml");
|
result = PMDExecutor.runPMD(createTemporaryReportFile(), tempDir, "-d", srcDir, "-R", "src/test/resources/rulesets/sample-ruleset.xml");
|
||||||
result.assertExitCode(4);
|
result.assertExitCode(4);
|
||||||
result.assertErrorOutputContains("[main] INFO net.sourceforge.pmd.cli - Log level is at INFO");
|
result.assertNoErrorInReport("[DEBUG] Log level is at TRACE");
|
||||||
|
|
||||||
|
|
||||||
// now with debug
|
// now with debug
|
||||||
result = PMDExecutor.runPMD(createTemporaryReportFile(), tempDir, "-d", srcDir, "-R", "src/test/resources/rulesets/sample-ruleset.xml", "--debug");
|
result = PMDExecutor.runPMD(createTemporaryReportFile(), tempDir, "-d", srcDir, "-R", "src/test/resources/rulesets/sample-ruleset.xml", "--debug");
|
||||||
result.assertExitCode(4);
|
result.assertExitCode(4);
|
||||||
result.assertErrorOutputContains("[main] INFO net.sourceforge.pmd.cli - Log level is at TRACE");
|
result.assertErrorOutputContains("[DEBUG] Log level is at TRACE");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
org.slf4j.simpleLogger.logFile=System.err
|
org.slf4j.simpleLogger.logFile=System.err
|
||||||
org.slf4j.simpleLogger.showDateTime=false
|
org.slf4j.simpleLogger.showDateTime=false
|
||||||
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSSXXX
|
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSSXXX
|
||||||
org.slf4j.simpleLogger.showThreadName=true
|
org.slf4j.simpleLogger.showThreadName=false
|
||||||
org.slf4j.simpleLogger.showThreadId=false
|
org.slf4j.simpleLogger.showThreadId=false
|
||||||
org.slf4j.simpleLogger.showLogName=true
|
org.slf4j.simpleLogger.showLogName=false
|
||||||
org.slf4j.simpleLogger.showShortLogName=false
|
org.slf4j.simpleLogger.showShortLogName=false
|
||||||
org.slf4j.simpleLogger.levelInBrackets=false
|
org.slf4j.simpleLogger.levelInBrackets=true
|
||||||
|
|
||||||
# Default log level for all loggers
|
# Default log level for all loggers
|
||||||
# Must be one of "trace", "debug", "info", "warn", "error" or "off"
|
# Must be one of "trace", "debug", "info", "warn", "error" or "off"
|
||||||
|
Reference in New Issue
Block a user