-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide customized access log #1357
Conversation
@limaoning @simonbasle What do you think if the access log functionality is moved to its own package (e.g. @limaoning Can you add javadoc to the public API? I like the idea, once we agree on the package and we have a javadoc, I'll make a detailed review. |
Yeah that makes sense to me if that possible 👍 |
@violetagg The code has been submitted, please take a look. |
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLog.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLogArgProviderH2.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLogHandler.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLogHandler.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLogHandlerH2.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLogHandlerH2.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #1357 +/- ##
============================================
+ Coverage 69.45% 70.52% +1.06%
- Complexity 1768 1826 +58
============================================
Files 139 144 +5
Lines 8998 9071 +73
Branches 1222 1232 +10
============================================
+ Hits 6250 6397 +147
+ Misses 2098 2013 -85
- Partials 650 661 +11
Continue to review full report at Codecov.
|
...netty-http/src/main/java/reactor/netty/http/server/logging/AbstractAccessLogArgProvider.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLog.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLogArgProviderH1.java
Outdated
Show resolved
Hide resolved
...-netty-http/src/test/java/reactor/netty/http/server/logging/AccessLogArgProviderH1Tests.java
Outdated
Show resolved
Hide resolved
...-netty-http/src/test/java/reactor/netty/http/server/logging/AccessLogArgProviderH2Tests.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/server/logging/AccessLogHandlerH2Tests.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/server/logging/AccessLogHandlerTests.java
Outdated
Show resolved
Hide resolved
...or-netty-http/src/test/java/reactor/netty/http/server/logging/BaseAccessLogHandlerTests.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/server/logging/LoggingTests.java
Outdated
Show resolved
Hide resolved
*/ | ||
final class AccessLogHandler extends ChannelDuplexHandler { | ||
public final class AccessLogHandler extends BaseAccessLogHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to maintain consistency, I'd rename this class to AccessLogHandlerH1
.
@violetagg @limaoning I'm also wondering about the public
status of this and the H2 implementations. maybe moving everything in logging
package wasn't such a good idea 😖
I wonder if it wouldn't be better to put the concrete classes back into the base http.server
package, as package-private, and only keep the interfaces and user-facing classes here in http.server.logging
. ie classes that make sense for a user to implement/customize/inherit from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to maintain consistency, I'd rename this class to AccessLogHandlerH1.
Agree with that
And let's move to the http.server
package ONLY the handlers BaseAccessLogHandler
, AccessLogHandlerH1
, AccessLogHandlerH2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But AccessLogArgProviderH1
, AccessLogArgProviderH2
will be public
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we move them to http.server
they can be package private - that's the idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are saying move handlers to http.server
, but AccessLogArgProviderH1
, AccessLogArgProviderH2
are not, and they will be public
. Otherwise, move AccessLogArgProviderH1
, AccessLogArgProviderH2
to http.server
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simonbasle Here I think we either move everything or keep the handlers public as @limaoning noted in the comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me think a bit here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some rough idea
public class AccessLogHandlerFactory {
ChannelHandler newAccessLogHandler(@Nullable Function<AccessLogArgProvider, AccessLog> accessLog, boolean isHttp2) {
return isHttp2 ? new AccessLogHandlerH2(accessLog) : new AccessLogHandlerH1(accessLog);
}
}
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be OK.
reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServerConfig.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServerConfig.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServerConfig.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServerConfig.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServerConfig.java
Outdated
Show resolved
Hide resolved
...-netty-http/src/test/java/reactor/netty/http/server/logging/AccessLogArgProviderH2Tests.java
Outdated
Show resolved
Hide resolved
...or-netty-http/src/test/java/reactor/netty/http/server/logging/AccessLogArgProviderTests.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/server/logging/AccessLogHandlerH2Tests.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/server/logging/AccessLogHandlerTests.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/server/logging/AccessLogHandlerTests.java
Outdated
Show resolved
Hide resolved
4566849
to
c990e56
Compare
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/AccessLogHandlerFactory.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/BaseAccessLogHandler.java
Outdated
Show resolved
Hide resolved
...netty-http/src/main/java/reactor/netty/http/server/logging/AbstractAccessLogArgProvider.java
Outdated
Show resolved
Hide resolved
...netty-http/src/main/java/reactor/netty/http/server/logging/AbstractAccessLogArgProvider.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/server/logging/BaseAccessLogHandler.java
Outdated
Show resolved
Hide resolved
@simonbasle PTAL |
@limaoning I squashed and committed the changes 9e44b6d. Thanks for that contribution! |
Hello! Do you have some readme regarding changes for access log? |
@IvanSmurygin Currently there is no reference documentation for this particular change. Are you interested in providing a PR with such? |
There is still no way to log response headers in access log even after the above change. Are we planning to add it in future?? |
@nikban95 By default Reactor Netty provides Common Log Format. If you need another format you can easily provide it by yourself. Here is a documentation: Please ask you questions on Gitter or stackoverflow.com |
@violetagg What he means is that there is no way to get response header, only the method to get request header. |
@violetagg As @limaoning has pointed out. Currently we can only log request headers only but the response headers can't be logged. So was asking about the same. |
@nikban95 @limaoning mmmm correct. Can you create an issue to expose the response headers via |
Sure @violetagg. Created an issue: #1505. Will check if i can provide the pr for the same. |
great! |
No description provided.