I would like to decorate my logs with some data in MDC that needs to be captured synchronously at the time of logging. Namely - open tracing IDs.
In logback-classic, the user can configure the async appender in XML, so I don't have to do anything special there.
In Dropwizard 1.3, all appenders seem to be async, but the AsyncAppenderFactory doesn't inherit from Discoverable and doesn't appear to be injectable via configuration. In order to use my AsyncAppender, I have to derive from each individual AppenderFactory and override wrapAsync
to use my AppenderFactory.
I would like to open a PR that would:
- Make AsyncAppenderFactory inherit from Discoverable
- Add a configuration parameter under logging that would support setting this (similar to LayoutFactory and AppenderFactory instances today).
- Use AsyncLoggingEventAppenderFactory by default if not configured
I'm open to:
- Being wrong; I may have missed something when reading the code
- Other ways of implementing this; Discoverable seems to be the consistent pattern
- The name and placement of the config parameter in logging
- Whether or not this would apply to the request logs (my default is no, since request logs are typically very specific and rarely customized as much).
- The JsonTypeName applied to the default AsyncLoggingEventAppenderFactory