From 2f541954cc8884a30e8ea2eb0d148b8e9c20615c Mon Sep 17 00:00:00 2001 From: Elizabeth Chatman Date: Mon, 18 Oct 2021 23:32:39 -0700 Subject: [PATCH] Give StringBuilder an initial capacity of 256 (#150) closes #149 --- .../src/main/java/co/elastic/logging/logback/EcsEncoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logback-ecs-encoder/src/main/java/co/elastic/logging/logback/EcsEncoder.java b/logback-ecs-encoder/src/main/java/co/elastic/logging/logback/EcsEncoder.java index 80ecf1e1..f961fb73 100644 --- a/logback-ecs-encoder/src/main/java/co/elastic/logging/logback/EcsEncoder.java +++ b/logback-ecs-encoder/src/main/java/co/elastic/logging/logback/EcsEncoder.java @@ -95,7 +95,7 @@ public void close() throws IOException { @Override public byte[] encode(ILoggingEvent event) { - StringBuilder builder = new StringBuilder(); + StringBuilder builder = new StringBuilder(256); EcsJsonSerializer.serializeObjectStart(builder, event.getTimeStamp()); EcsJsonSerializer.serializeLogLevel(builder, event.getLevel().toString()); EcsJsonSerializer.serializeFormattedMessage(builder, event.getFormattedMessage());