Skip to content

Commit

Permalink
fixes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
agido-jrieks committed Jan 10, 2023
1 parent ef8ac50 commit 50a1897
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,17 @@ private void serializeIndexString(JsonGenerator gen, T event) throws IOException
}

private void serializeEvent(JsonGenerator gen, T event, List<AbstractPropertyAndEncoder<T>> propertyList) throws IOException {
gen.writeStartObject();
try {
gen.writeStartObject();

serializeCommonFields(gen, event);
serializeCommonFields(gen, event);

for (AbstractPropertyAndEncoder<T> pae : propertyList) {
propertySerializer.serializeProperty(gen, event, pae);
for (AbstractPropertyAndEncoder<T> pae : propertyList) {
propertySerializer.serializeProperty(gen, event, pae);
}
} finally {
gen.writeEndObject();
}

gen.writeEndObject();
}

protected abstract void serializeCommonFields(JsonGenerator gen, T event) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected void serializeCommonFields(JsonGenerator gen, ILoggingEvent event) thr
gen.writeRawValue(event.getFormattedMessage());
} else {
String formattedMessage = event.getFormattedMessage();
if (settings.getMaxMessageSize() > 0 && formattedMessage.length() > settings.getMaxMessageSize()) {
if (settings.getMaxMessageSize() > 0 && formattedMessage != null && formattedMessage.length() > settings.getMaxMessageSize()) {
formattedMessage = formattedMessage.substring(0, settings.getMaxMessageSize()) + "..";
}
gen.writeObjectField("message", formattedMessage);
Expand Down

0 comments on commit 50a1897

Please sign in to comment.