Remko Popma created LOG4J2-1305:
-----------------------------------
Summary: Binary Layout
Key: LOG4J2-1305
URL: https://issues.apache.org/jira/browse/LOG4J2-1305
Project: Log4j 2
Issue Type: New Feature
Components: Layouts
Reporter: Remko Popma
Logging in a binary format instead of in text can give large performance
improvements. Text-based logging formats are supported by layouts like
PatternLayout, and performance investigations like done in LOG4J2-930 suggest
that it may be difficult to achieve good performance when logging text.
Logging text means going from a LogEvent object to formatted text, and then
converting this text to bytes. A different approach would be to convert the
LogEvent to a binary representation directly without creating a text
representation first. This may make fast synchronous logging possible, although
that would additionally require a lock-free appender (LOG4J2-928).
This proposes a simple BinaryLayout, where each LogEvent is logged in a binary
record like this:
||Offset||Type||Description||
|0|long|TimeMillis|
|8|long|NanoTime|
|16|int|Level|
|20|int|Logger name index - string value in separate file|
|24|int|Thread name index - string value in separate file|
|28|long|Thread ID|
|36|short|Marker count|
|38|int|marker name index - string value in separate file ... (below offset
assumes only one marker)|
|42|int|Message length|
|46|int|Message type|
|50|byte[]|Message data - below offset assumes 10 bytes of message data|
|60|int| Throwable data length|
|64|byte[]|Throwable data - below offset assumes 10 bytes of Throwable data|
|74|int|ThreadContext key/value pair count|
|78|int|ThreadContext key index - string value in separate file|
|82|int|ThreadContext value index - string value in separate file|
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]