GitHub user ijuma opened a pull request: https://github.com/apache/kafka/pull/4250
KAFKA-6261: Fix exception thrown by request logging if acks=0 Only expect responseAsString to be set if request logging is enabled _and_ responseSend is defined. Also fixed a couple of issues that would manifest themselves if trace logging is enabled: - `MemoryRecords.toString` should not throw exception if data is corrupted - Generate `responseString` correctly if unsupported api versions request is received. Unit tests were added for every issue fixed. Also changed SocketServerTest to run with trace logging enabled as request logging breakage has been a common issue. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) You can merge this pull request into a Git repository by running: $ git pull https://github.com/ijuma/kafka fix-issues-when-trace-logging-is-enabled Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/4250.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #4250 ---- commit 0d63d0100cfacfb76f7f28190084d28c5e468422 Author: Ismael Juma <ism...@juma.me.uk> Date: 2017-11-22T16:00:29Z Generate responseString correctly if unsupported api versions request is received commit 3973541214e8f442dcf29a947610ca0bd31b42a9 Author: Ismael Juma <ism...@juma.me.uk> Date: 2017-11-22T16:01:13Z MemoryRecords.toString should not throw exception is data is corrupted commit a563bac859bdc7f210f6f61f104d5b93fb129878 Author: Ismael Juma <ism...@juma.me.uk> Date: 2017-11-22T16:03:18Z Don't throw exception on no op responses if request logging is enabled commit 90993c573c52a0b675b54053f635165a3f6c4854 Author: Ismael Juma <ism...@juma.me.uk> Date: 2017-11-22T16:07:06Z Fix nit ---- ---