use of org.apache.log4j.spi.LoggingEvent in project flink by apache.
the class UtilsTest method checkForLogString.
public static void checkForLogString(String expected) {
LoggingEvent found = getEventContainingString(expected);
if (found != null) {
LOG.info("Found expected string '" + expected + "' in log message " + found);
return;
}
Assert.fail("Unable to find expected string '" + expected + "' in log messages");
}
use of org.apache.log4j.spi.LoggingEvent in project hadoop by apache.
the class ContainerLogAppender method close.
@Override
public synchronized void close() {
closing = true;
if (tail != null) {
for (LoggingEvent event : tail) {
super.append(event);
}
}
super.close();
}
use of org.apache.log4j.spi.LoggingEvent in project neo4j by neo4j.
the class Slf4jLogProviderTest method assertLogOccurred.
private void assertLogOccurred(Level level, String message) {
ArrayList<LoggingEvent> events = getLoggingEvents();
assertThat(events, hasSize(1));
LoggingEvent event = events.get(0);
assertThat(event.getLoggerName(), is(getClass().getName()));
assertThat(event.getLevel(), is(level));
assertThat(event.getMessage(), is((Object) message));
}
use of org.apache.log4j.spi.LoggingEvent in project intellij-community by JetBrains.
the class TestLoggerFactory method log.
static void log(@NotNull org.apache.log4j.Logger logger, @NotNull Level level, @Nullable String message, @Nullable Throwable t) {
if (!UsefulTestCase.IS_UNDER_TEAMCITY) {
//return;
}
LoggingEvent event = new LoggingEvent(CFQN, logger, level, message, t);
APPENDER.doAppend(event);
if (BUFFER.length() > MAX_BUFFER_LENGTH) {
synchronized (BUFFER) {
if (BUFFER.length() > MAX_BUFFER_LENGTH) {
BUFFER.delete(0, BUFFER.length() - MAX_BUFFER_LENGTH + MAX_BUFFER_LENGTH / 4);
}
}
}
}
use of org.apache.log4j.spi.LoggingEvent in project intellij-plugins by JetBrains.
the class LightTestCase method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
ourShouldFail = false;
Logger.getRootLogger().addAppender(new AppenderSkeleton() {
@Override
protected void append(LoggingEvent loggingEvent) {
if (loggingEvent.level.isGreaterOrEqual(Priority.ERROR)) {
ourShouldFail = true;
}
}
@Override
public boolean requiresLayout() {
return false;
}
@Override
public void close() {
}
});
}
Aggregations