Allow constomizing the log format produced by `Logging{Service,Client}`
See original GitHub issueThe logs produced by LoggingService and LoggingClient are human-readable.
However, this non-structured text is not good when users want to store the log file to Elastic Search or other key-value storage.
We can give an extension API to users to customize the output format. For example:
interface LogFormat {
static LogFormat ofText() {
// return a log message formatted by the default formatter.
}
static LogFormat ofJson() {
// return a log message serialized to JSON format
}
String format(RequestLog log, LogSanitizers sanitizers);
}
class LogSanitizers {
BiFunction<? super RequestContext, ? super RequestHeaders, ? extends @Nullable Object> requestHeadersSanitizer;
BiFunction<? super RequestContext, Object, ? extends @Nullable Object> requestContentSanitizer;
...
}
LoggingService.builder()
// Customize the log message format using LogFormat
.format(LogFormat.ofJson())
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (11 by maintainers)
Top Results From Across the Web
Enabling logging from certain AWS services
Explains the permissions necessary for sending logs from some AWS services to CloudWatch Logs, Amazon S3, or Kinesis Data Firehose.
Read more >Customizing the HTTP access log - Oracle Help Center
You can customize the format of the default HTTP access log. By default, WebLogic Server keeps a log of all HTTP transactions in...
Read more >Logging Cookbook — Python 3.11.1 documentation
Let's say you want to log to console and file with different message formats and in differing circumstances. Say you want to log...
Read more >Console log formatting - .NET - Microsoft Learn
Previously, the ConsoleLoggerFormat enum allowed for selecting the desired log format, either human readable which was the Default ...
Read more >Customizing the Log Format - OpenLiteSpeed
Customizing Log Format in OpenLiteSpeed is possible, and something you may wish to do during the troubleshooting process.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

hasInterestedFlags(flags, RequestLogProperty.REQUEST_LENGTH)must be the same withRequestLog.isAvailable(RequestLogProperty.REQUEST_LENGTH). By the way,flagsis a volatile value. So it is bad to access it repeatedly. How about adding an API that returns all availableRequestLogPropertys?Sure ❤️