Closed marceloverdijk closed 4 years ago
Probably not that easy as the http logging is tight to the servlet api, which Micronaut is not using. It is similar as https://github.com/zalando/logbook/issues/331.
What is micronaut using? Netty directly?
On Mon, 4 Nov 2019, 10:57 Marcel Overdijk, notifications@github.com wrote:
Probably not that easy as the http logging is tight to the servlet api, which Micronaut is not using. It is similar as #331 https://github.com/zalando/logbook/issues/331.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zalando/logbook/issues/629?email_source=notifications&email_token=AADI7HINTRYEZIOKD7ALI43QR7WXVA5CNFSM4JIQ6U7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC6WUPI#issuecomment-549284413, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADI7HLKGBGVGESWOJEV4UDQR7WXVANCNFSM4JIQ6U7A .
@whiskeysierra Under the hood yes, but not directly. But exposed in the framework they have their own classes like Micronaut's HttpRequest similar as Spring WebFlux has ServerRequest That's why I made the second comment that it might not be that easy.
If we could build a module for Netty than that could cover #331 as well
@marceloverdijk Do you happen to have experience with micronaut in terms of a customized netty setup by any chance?
@whiskeysierra unfortunately not, maybe good to reach out to @graemerocher or discuss it on https://gitter.im/micronautfw/questions
What is it you want to achieve?
I want to register a custom ChannelHandler which does http-specific traffic logging.
Seems currently we only allow injection of instances of ChannelOutboundHandler
if your instance is a ChannelOutboundHandler
then you can do:
@javax.inject.Singleton
class MyHandler implements ChannelOutboundHandler {
// your impl
}
And it will be registered automatically
@graemerocher Can I control the position within the pipeline?
You can implemented Ordered
but that doesn't seem to provide full control at the moment. Where does it need to go in the pipeline?
After the http codec. I need to observe Netty's HttpRequest
and HttpResponse
objects as messages in my handler.
Seems like we need a better API for that. Can you report an issue https://github.com/micronaut-projects/micronaut-core/issues
@whiskeysierra Is there a way to try netty support for logbook? 'https://oss.sonatype.org/content/repositories/snapshots' and 2.1.0-SNAPSHOT doesn't work.
Would you consider adding a
logbook-micronaut-configuration
module similar aslogbook-spring-boot-starter
? Or accepting a PR for this?