use of ch.qos.logback.classic.spi.ILoggingEvent in project jackrabbit-oak by apache.
the class RepositoryTest method largeMultiValueProperty.
@Test
public void largeMultiValueProperty() throws Exception {
final List<String> logMessages = Lists.newArrayList();
Appender<ILoggingEvent> a = new AppenderBase<ILoggingEvent>() {
@Override
protected void append(ILoggingEvent e) {
if (Level.WARN.isGreaterOrEqual(e.getLevel())) {
logMessages.add(e.getFormattedMessage());
}
}
};
a.start();
rootLogger().addAppender(a);
Session session = getAdminSession();
Node node = session.getRootNode().addNode("largeMultiValueProperty", "nt:unstructured");
// ItemImpl.MV_PROPERTY_WARN_THRESHOLD - 1000
String[] largeArray = new String[1000 + 1];
Arrays.fill(largeArray, "x");
Property p = node.setProperty("fooProp", largeArray);
Property p2 = node.setProperty("barProp", new String[] { "x" });
p2.setValue(largeArray);
session.save();
rootLogger().detachAppender(a);
a.stop();
assertTrue(logMessages.size() >= 2);
assertThat("Warn log message must contains a reference to the large array property path", logMessages.toString(), containsString(p.getPath()));
assertThat("Warn log message must contains a reference to the large array property path", logMessages.toString(), containsString(p2.getPath()));
}
use of ch.qos.logback.classic.spi.ILoggingEvent in project cdap by caskdata.
the class LogPipelineConfigurator method buildInterpreter.
@Override
protected void buildInterpreter() {
super.buildInterpreter();
RuleStore ruleStore = interpreter.getRuleStore();
ruleStore.addRule(new Pattern("configuration/contextName"), new ContextConfigAction(cConf));
ruleStore.addRule(new Pattern("configuration/appender"), new WrapAppenderAction<ILoggingEvent>());
}
use of ch.qos.logback.classic.spi.ILoggingEvent in project cdap by caskdata.
the class LogDataOffsetProducer method encodeSend.
@Override
public Object encodeSend(LogEvent logEvent) {
ILoggingEvent event = logEvent.getLoggingEvent();
StackTraceElement[] stackTraceElements = event.getCallerData();
String className = "";
String simpleClassName = "";
int lineNumber = 0;
boolean isNativeMethod = false;
if (stackTraceElements != null && stackTraceElements.length > 0) {
StackTraceElement first = stackTraceElements[0];
className = first.getClassName();
simpleClassName = (className.indexOf('.') >= 0) ? className.substring(className.lastIndexOf('.') + 1) : className;
lineNumber = first.getLineNumber();
isNativeMethod = first.isNativeMethod();
}
LogData logData = new LogData(event.getTimeStamp(), event.getLevel().toString(), event.getThreadName(), className, simpleClassName, lineNumber, event.getFormattedMessage(), ThrowableProxyUtil.asString(event.getThrowableProxy()), event.getLoggerName(), event.getMDCPropertyMap(), isNativeMethod);
return modifyLogJsonElememnt(GSON.toJsonTree(new FormattedLogDataEvent(logData, logEvent.getOffset())));
}
use of ch.qos.logback.classic.spi.ILoggingEvent in project cdap by caskdata.
the class LogDataOffsetCallback method encodeSend.
@Override
public Object encodeSend(LogEvent logEvent) {
ILoggingEvent event = logEvent.getLoggingEvent();
StackTraceElement[] stackTraceElements = event.getCallerData();
String className = "";
String simpleClassName = "";
int lineNumber = 0;
boolean isNativeMethod = false;
if (stackTraceElements != null && stackTraceElements.length > 0) {
StackTraceElement first = stackTraceElements[0];
className = first.getClassName();
simpleClassName = (className.indexOf('.') >= 0) ? className.substring(className.lastIndexOf('.') + 1) : className;
lineNumber = first.getLineNumber();
isNativeMethod = first.isNativeMethod();
}
LogData logData = new LogData(event.getTimeStamp(), event.getLevel().toString(), event.getThreadName(), className, simpleClassName, lineNumber, event.getFormattedMessage(), ThrowableProxyUtil.asString(event.getThrowableProxy()), event.getLoggerName(), event.getMDCPropertyMap(), isNativeMethod);
return modifyLogJsonElememnt(GSON.toJsonTree(new FormattedLogDataEvent(logData, logEvent.getOffset())));
}
use of ch.qos.logback.classic.spi.ILoggingEvent in project cdap by caskdata.
the class KafkaLogProcessorPipelineTest method createLoggingEvent.
/**
* Creates a new {@link ILoggingEvent} with the given information.
*/
private ILoggingEvent createLoggingEvent(String loggerName, Level level, String message, long timestamp) {
LoggingEvent event = new LoggingEvent();
event.setLevel(level);
event.setLoggerName(loggerName);
event.setMessage(message);
event.setTimeStamp(timestamp);
return event;
}
Aggregations