SumoLogic / sumologic-java-http-core

Core Java components for sending data to Sumo Logic HTTP sources
Apache License 2.0
2 stars 4 forks source link

SumoBufferFlushingTask StringBuilder optimization #10

Open ruslan-belinskyy opened 4 years ago

ruslan-belinskyy commented 4 years ago

I'm trying to understand why following StringBuilder is initialized with assumption that each log message should have 10 characters: https://github.com/SumoLogic/sumologic-java-http-core/blob/a482443a7f7bb7bf0beeb99e39b19308d850e496/src/main/java/com/sumologic/http/sender/SumoBufferFlushingTask.java#L70

According to Sumo docs logs should have at least timestamp: https://help.sumologic.com/03Send-Data/Sources/04Reference-Information-for-Sources/Timestamps%2C-Time-Zones%2C-Time-Ranges%2C-and-Date-Formats Timestamp alone will have more than 10 characters.

Ideally i think this should be configurable by user. But as default you can take from any logger which works for you, for example logback(256): https://github.com/qos-ch/logback/blob/master/logback-core/src/main/java/ch/qos/logback/core/pattern/PatternLayoutBase.java#L30