Skip to content
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

Log an entry in warning level for a 400 or 413 response #5295

Merged
merged 1 commit into from
Nov 1, 2022

Conversation

spericas
Copy link
Member

@spericas spericas commented Nov 1, 2022

Very simple enhancement for issue #5174 that logs an entry in warning level for a 400 or 413 response returned by the ForwardingHandler. Note that the access log is not reached if an error is reported at this stage, so these log entries should help diagnose problems.

This seems a lot simpler than creating a new log file or attempting to use the access log (which may not be enabled) just for this purpose. The log entry that includes the error is very visible as shown below:

2022.11.01 11:45:03 INFO io.helidon.common.HelidonFeatures Thread[features-thread,5,main]: Helidon SE 3.0.3-SNAPSHOT features: [Config, Tracing, Web Client, WebServer]
2022.11.01 11:45:03 INFO io.helidon.webserver.NettyWebServer Thread[nioEventLoopGroup-2-1,10,main]: Channel '@default' started: [id: 0xa063c0ce, L:/127.0.0.1:64280]
2022.11.01 11:45:03 INFO io.helidon.webserver.MaxPayloadSizeTest Thread[main,5,main]: Started server at: https://localhost:64280
2022.11.01 11:45:04 WARNING io.helidon.webserver.ForwardingHandler Thread[nioEventLoopGroup-3-1,10,main]: 413: Payload is too large
java.lang.Error: 413: Payload is too large
	at io.helidon.webserver/io.helidon.webserver.ForwardingHandler.send413PayloadTooLarge(ForwardingHandler.java:551)
	at io.helidon.webserver/io.helidon.webserver.ForwardingHandler.channelReadHttpRequest(ForwardingHandler.java:379)
	at io.helidon.webserver/io.helidon.webserver.ForwardingHandler.lambda$channelRead0$3(ForwardingHandler.java:156)
	at io.helidon.common.context/io.helidon.common.context.Contexts.runInContext(Contexts.java:137)
        ...

…he ForwardingHandler. Note that the access log is not reached if an error is reported at this stage, so these log entries should help diagnose problems.
@spericas spericas added enhancement New feature or request webserver logging labels Nov 1, 2022
@spericas spericas added this to the 3.1.0 milestone Nov 1, 2022
@spericas spericas self-assigned this Nov 1, 2022
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 1, 2022
@spericas spericas changed the title Log an entry in warning level for a 400 or 413 responses Log an entry in warning level for a 400 or 413 response Nov 1, 2022
Copy link
Member

@klustria klustria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine compromise, hence approving.

@spericas spericas merged commit d7dc47b into helidon-io:helidon-3.x Nov 1, 2022
@spericas spericas linked an issue Nov 1, 2022 that may be closed by this pull request
spericas added a commit to spericas/helidon that referenced this pull request Nov 1, 2022
…he ForwardingHandler. Note that the access log is not reached if an error is reported at this stage, so these log entries should help diagnose problems. (helidon-io#5295)
@barchetta barchetta added this to Closed in Backlog Nov 3, 2022
spericas added a commit that referenced this pull request Nov 9, 2022
* Log an entry in warning level for a 400 or 413 response returned by the ForwardingHandler. Note that the access log is not reached if an error is reported at this stage, so these log entries should help diagnose problems. (#5295)

* Log simple message for a 400 or a 413 and a more detailed message if log FINE level is enabled.

* Remove extra log line.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>

* Remove whitespace from method signature

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Co-authored-by: Tomas Langer <tomas.langer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request logging OCA Verified All contributors have signed the Oracle Contributor Agreement. webserver
Projects
Backlog
  
Closed
Development

Successfully merging this pull request may close these issues.

[3.x] No AccessLog output with http response 413
2 participants