logbook icon indicating copy to clipboard operation
logbook copied to clipboard

Question: Would it be possible to log request and response in the same log entry?

Open bgalek opened this issue 11 months ago • 2 comments

Hi! One of my teams asked if my team could develop a logbook strategy that would log requests and responses in the same log message.

Example:

>> INCOMING >> AFTER REQUEST  
Request: GET /api/endpoint?parameter=allegro-pl  
  Body: <empty body>  
Response: Status 200, took 5 ms  
  Body: {"works":true}  

I can think of some potential problems (but this library solves some) BUT I wanted to know your opinion as maintainers! Did you thought about such feature? Or maybe I missed that this feature is actually supported? :)

bgalek avatar Mar 06 '25 10:03 bgalek

friendly ping :)

bgalek avatar Mar 17 '25 08:03 bgalek

Hey @bgalek, what you want to achieve is possible to do via a custom Sink implementation, that would write the log only when void write(Correlation correlation, HttpRequest, HttpResponse response) is called. See CommonsLogFormatSink as an example.

kasmarian avatar Mar 17 '25 17:03 kasmarian

In order to prioritize the support for Logbook, we would like to check whether the old issues are still relevant. This issue has not been updated for over six months.

  • Please check if it is still relevant in latest version of the Logbook.
  • If so, please add a descriptive comment to keep the issue open.
  • Otherwise, the issue will automatically be closed after a week.

github-actions[bot] avatar Sep 15 '25 02:09 github-actions[bot]