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

Response is not getting logged for Jax-RS async apis #621

Closed
rohanarya opened this issue Oct 16, 2019 · 8 comments · Fixed by #624
Closed

Response is not getting logged for Jax-RS async apis #621

rohanarya opened this issue Oct 16, 2019 · 8 comments · Fixed by #624
Labels

Comments

@rohanarya
Copy link

I am using jax-rx async to expose rest api's. I use the @suspended annotation to get hold of the AsyncResponse object and call AsyncResponse#resume to submit the response. Logbook is logging the request by not logging the response. On debugging I realize "isLastRequest()" in the below code snippet from NormalStratergy.java always returns false.

I am using spring boot 2 auto-configuration to configure logback with defaults.

NormalStrategy.java

private void logResponse(final Correlator correlator, final RemoteRequest request, final LocalResponse response) throws IOException { if (isLastRequest(request)) { response.getWriter().flush(); correlator.write(response) } }

Demo Project : https://github.com/rohanarya/logbook-jersey-async/

Original Issue : #620

@whiskeysierra
Copy link
Collaborator

See #624

@rohanarya
Copy link
Author

@whiskeysierra when can I expect the fix to be merged and released?

@whiskeysierra
Copy link
Collaborator

I can't properly test that right now.

@whiskeysierra whiskeysierra reopened this Oct 28, 2019
@rohanarya
Copy link
Author

I have added your fix to my demo project. I feel it looks OK, you can try it in case it helps to test.

@rohanarya
Copy link
Author

@whiskeysierra any update on this?

@whiskeysierra
Copy link
Collaborator

Still struggling to write a proper test for this using Spring MVC.

whiskeysierra added a commit that referenced this issue Dec 3, 2019
@whiskeysierra
Copy link
Collaborator

I finally found some time digging into this and rewrote the existing test to use a real web server instead of MockMvc. The filter now works with tomcat and undertow. See #624

whiskeysierra added a commit that referenced this issue Dec 3, 2019
@whiskeysierra
Copy link
Collaborator

Fix has been released as 2.0.0-RC.7. Thanks for raising the issue! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants