use of org.apache.log4j.spi.ThrowableInformation in project lucene-solr by apache.
the class Log4jWatcher method toSolrDocument.
@Override
public SolrDocument toSolrDocument(LoggingEvent event) {
SolrDocument doc = new SolrDocument();
doc.setField("time", new Date(event.getTimeStamp()));
doc.setField("level", event.getLevel().toString());
doc.setField("logger", event.getLogger().getName());
doc.setField("message", event.getRenderedMessage());
ThrowableInformation t = event.getThrowableInformation();
if (t != null) {
doc.setField("trace", Throwables.getStackTraceAsString(t.getThrowable()));
}
// Will be null if not present
doc.setField("core", event.getMDC(ZkStateReader.CORE_NAME_PROP));
doc.setField("collection", event.getMDC(ZkStateReader.COLLECTION_PROP));
doc.setField("replica", event.getMDC(ZkStateReader.REPLICA_PROP));
doc.setField("shard", event.getMDC(ZkStateReader.SHARD_ID_PROP));
return doc;
}
Aggregations