use of org.apache.airavata.common.logging.LogEntry in project airavata by apache.
the class KafkaAppender method append.
@Override
protected void append(ILoggingEvent event) {
event.prepareForDeferredProcessing();
if (// OFF AND ALL are not loggable levels
!event.getLevel().equals(Level.ALL) && !event.getLevel().equals(Level.OFF)) {
final IThrowableProxy throwableProxy = event.getThrowableProxy();
final LogEntry entry = throwableProxy != null ? new LogEntry(serverId, event.getFormattedMessage(), Instant.ofEpochMilli(event.getTimeStamp()).toString(), event.getLevel().toString(), event.getLoggerName(), event.getMDCPropertyMap(), event.getThreadName() != null ? event.getThreadName() : null, new Exception(throwableProxy.getMessage(), toStringArray(throwableProxy.getStackTraceElementProxyArray()), throwableProxy.getClassName())) : new LogEntry(serverId, event.getFormattedMessage(), Instant.ofEpochMilli(event.getTimeStamp()).toString(), event.getLevel().toString(), event.getLoggerName(), event.getMDCPropertyMap(), event.getThreadName() != null ? event.getThreadName() : null);
producer.send(new ProducerRecord<>(kafkaTopic, new Gson().toJson(entry)));
}
}
Aggregations