mirror of https://github.com/apache/lucene.git
SOLR-14129: Reuse Jackson ObjectMapper in AuditLoggerPlugin (#1104)
This commit is contained in:
parent
43e30f9665
commit
c4993bc99c
|
@ -182,6 +182,8 @@ Improvements
|
|||
|
||||
* SOLR-13808: filter in BoolQParser and {"bool":{"filter":..}} in Query DSL are cached by default (Mikhail Khludnev)
|
||||
|
||||
* SOLR-14129: Reuse Jackson ObjectMapper in AuditLoggerPlugin (janhoy)
|
||||
|
||||
Optimizations
|
||||
---------------------
|
||||
(No changes)
|
||||
|
|
|
@ -283,14 +283,15 @@ public abstract class AuditLoggerPlugin implements Closeable, Runnable, SolrInfo
|
|||
* Event formatter that returns event as JSON string
|
||||
*/
|
||||
public static class JSONAuditEventFormatter implements AuditEventFormatter {
|
||||
private static ObjectMapper mapper = new ObjectMapper()
|
||||
.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
|
||||
.setSerializationInclusion(Include.NON_NULL);
|
||||
|
||||
/**
|
||||
* Formats an audit event as a JSON string
|
||||
*/
|
||||
@Override
|
||||
public String formatEvent(AuditEvent event) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
|
||||
mapper.setSerializationInclusion(Include.NON_NULL);
|
||||
try {
|
||||
StringWriter sw = new StringWriter();
|
||||
mapper.writeValue(sw, event);
|
||||
|
|
Loading…
Reference in New Issue