use of org.apache.log4j.Appender in project scheduling by ow2-proactive.
the class TaskLogger method getStoredLogs.
public void getStoredLogs(AppenderProvider logSink) {
Appender appender;
try {
appender = logSink.getAppender();
} catch (LogForwardingException e) {
logger.error("Cannot create log appender.", e);
return;
}
taskLogAppender.appendStoredEvents(appender);
}
use of org.apache.log4j.Appender in project scheduling by ow2-proactive.
the class SchedulerStateRestLiveLogsTest method testLiveLogs_AvailableAndDelete.
@Test
public void testLiveLogs_AvailableAndDelete() throws Exception {
String firstJobId = "42";
assertEquals(-1, client.getLiveLogJobAvailable(sessionId, "42"));
String logs = client.getLiveLogJob(sessionId, firstJobId);
Appender appender = verifyListenAndGetAppender("42");
assertEquals(0, client.getLiveLogJobAvailable(sessionId, "42"));
assertTrue(logs.isEmpty());
appender.doAppend(createLoggingEvent(firstJobId, "first log"));
assertEquals(1, client.getLiveLogJobAvailable(sessionId, "42"));
assertTrue(client.deleteLiveLogJob(sessionId, "42"));
assertEquals(-1, client.getLiveLogJobAvailable(sessionId, "42"));
// will be lost
appender.doAppend(createLoggingEvent(firstJobId, "second log"));
logs = client.getLiveLogJob(sessionId, firstJobId);
assertTrue(logs.isEmpty());
appender.doAppend(createLoggingEvent(firstJobId, "other log"));
appender.doAppend(createLoggingEvent(firstJobId, "more log"));
assertEquals(2, client.getLiveLogJobAvailable(sessionId, "42"));
logs = client.getLiveLogJob(sessionId, firstJobId);
assertThat(logs, not(containsString("first log")));
assertThat(logs, containsString("other log"));
assertThat(logs, containsString("more log"));
assertEquals(0, client.getLiveLogJobAvailable(sessionId, "42"));
logs = client.getLiveLogJob(sessionId, firstJobId);
assertTrue(logs.isEmpty());
}
use of org.apache.log4j.Appender in project scheduling by ow2-proactive.
the class SchedulerStateRestLiveLogsTest method testLiveLogs_TwoJobsAtTheSameTime.
@Test
public void testLiveLogs_TwoJobsAtTheSameTime() throws Exception {
String firstJobId = "42";
String secondJobId = "43";
String firstJobLogs = client.getLiveLogJob(sessionId, firstJobId);
Appender firstAppender = verifyListenAndGetAppender(firstJobId);
String secondJobLogs = client.getLiveLogJob(sessionId, secondJobId);
Appender secondAppender = verifyListenAndGetAppender(secondJobId);
assertTrue(firstJobLogs.isEmpty());
assertTrue(secondJobLogs.isEmpty());
firstAppender.doAppend(createLoggingEvent(firstJobId, "first job"));
secondAppender.doAppend(createLoggingEvent(secondJobId, "second job"));
firstJobLogs = client.getLiveLogJob(sessionId, firstJobId);
assertThat(firstJobLogs, containsString("first job"));
secondJobLogs = client.getLiveLogJob(sessionId, secondJobId);
assertThat(secondJobLogs, containsString("second job"));
}
Aggregations