Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void setupLogAppender() {
org.apache.log4j.Logger rootLogger = LogManager.getRootLogger();

troubleshooterLogger = new AutoTroubleshooterLogAppender(issueRepository);
troubleshooterLogger.setThreshold(Level.WARN);
troubleshooterLogger.setThreshold(Level.ERROR);
troubleshooterLogger.activateOptions();
rootLogger.addAppender(troubleshooterLogger);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ public void canCollectAndRefineIssues()
AutomaticTroubleshooter troubleshooter = AutomaticTroubleshooterFactory.createForJob(new Properties());
try {
troubleshooter.start();
log.warn("Test warning");
log.error("Test error");

troubleshooter.refineIssues();
troubleshooter.logIssueSummary();

String summaryMessage = troubleshooter.getIssueSummaryMessage();
assertTrue(summaryMessage.contains("Test warning"));
assertTrue(summaryMessage.contains("Test error"));

String detailedMessage = troubleshooter.getIssueDetailsMessage();
assertTrue(detailedMessage.contains("Test warning"));
assertTrue(detailedMessage.contains("Test error"));

EventSubmitter eventSubmitter = mock(EventSubmitter.class);
troubleshooter.reportJobIssuesAsEvents(eventSubmitter);
Expand All @@ -72,7 +72,7 @@ public void canDisable()
AutomaticTroubleshooter troubleshooter = AutomaticTroubleshooterFactory.createForJob(properties);
try {
troubleshooter.start();
log.warn("Test warning");
log.error("Test error");

troubleshooter.refineIssues();
troubleshooter.logIssueSummary();
Expand All @@ -86,6 +86,22 @@ public void canDisable()
}
}

@Test
public void warnLogsAreNotCaptured()
throws Exception {
AutomaticTroubleshooter troubleshooter = AutomaticTroubleshooterFactory.createForJob(new Properties());
try {
troubleshooter.start();
log.warn("Test warning that should be ignored");

troubleshooter.refineIssues();

assertEquals(0, troubleshooter.getIssueRepository().getAll().size());
} finally {
troubleshooter.stop();
}
}

@Test
public void canDisableEventReporter()
throws Exception {
Expand All @@ -96,7 +112,7 @@ public void canDisableEventReporter()
try {
troubleshooter.start();

log.warn("Test warning");
log.error("Test error");

troubleshooter.refineIssues();
troubleshooter.logIssueSummary();
Expand Down
Loading