commit | da1d8eb7c0626850bb921f770a4c880bfdc0a0f2 | [log] [tgz] |
---|---|---|
author | Hang Chen <chenhang@apache.org> | Tue Aug 29 14:51:16 2023 +0800 |
committer | GitHub <noreply@github.com> | Tue Aug 29 14:51:16 2023 +0800 |
tree | cc5d17cd699b55830c55013927d488d0af106524 | |
parent | 5a47c1d3a0d4357272776c3131bac896e60be5fa [diff] |
Enable kv logs in log4j configuration (#3986) ### Motivation We introduced DirectIO since BookKeeper 4.16.0, and the DirectIO classes use KV-based Slf4jSlogger. https://github.com/apache/bookkeeper/blob/master/bookkeeper-slogger/slf4j/src/main/java/org/apache/bookkeeper/slogger/slf4j/Slf4jSlogger.java In order to print the KV out, we need to add `%X` flag in log4j2.yaml, otherwise the log will miss the detailed key and values. <!-- Explain here the context, and why you're making that change. What is the problem you're trying to solve. --> ### Modifications In order to reduce the impact on current logger appenders, I add MDC-based appenders for `CONSOLE`, `TRACEFILE`, and `ROLLINGFILE` by adding `%X` for log4j2.yaml Appender PatternLayout. Only classes under `org.apache.bookkeeper.bookie.storage.directentrylogger` will enable MDC-based appender logger. If the key value has items, the log will look like: ``` 2023-06-19T16:01:56,685+0800 [main] INFO org.apache.bookkeeper.bookie.storage.directentrylogger.EntryLogIdsImpl {dirs=[data/bookkeeper/ledgers/current], durationMs=0, event=ENTRYLOG_IDS_CANDIDATES_SELECTED, maxId=21474836 47, nextId=0} - ENTRYLOG_IDS_CANDIDATES_SELECTED 2023-06-19T16:01:56,721+0800 [main] INFO org.apache.bookkeeper.bookie.storage.directentrylogger.DirectEntryLogger {directory=data/bookkeeper/ledgers/current, event=ENTRYLOGGER_CREATED, maxCachedReaders=32, maxCachedReader sPerThread=4, maxFileSize=1073741824, maxSaneEntrySize=5252620, perThreadBufferSize=33554432, readBufferSize=8388608, singleWriteBufferSize=33554432, totalReadBufferSize=268435456, totalWriteBufferSize=268435456} - ENTRYLO GGER_CREATED ```
Apache BookKeeper is a scalable, fault-tolerant and low latency storage service optimized for append-only workloads.
It is suitable for being used in following scenarios:
Please visit the Documentation from the project website for more information.
For filing bugs, suggesting improvements, or requesting new features, help us out by opening a GitHub issue.
Subscribe or mail the user@bookkeeper.apache.org list - Ask questions, find answers, and also help other users.
Subscribe or mail the dev@bookkeeper.apache.org list - Join development discussions, propose new ideas and connect with contributors.
Join us on Slack - This is the most immediate way to connect with Apache BookKeeper committers and contributors.
We feel that a welcoming open community is important and welcome contributions.
See our installation guide to get your local environment setup.
Take a look at our open issues: GitHub Issues.
Review our coding style and follow our pull requests to learn more about our conventions.
Make your changes according to our contributing guide