If I send JSON without a request body:
POST /stuff
Content-Type: application/json
Content-Length: 0
<---- Body missing!
… to my DropWizard (Jersey) resource,
private class PostBody { public String a };
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response create(@Valid PostBody body)
{ … }
Right now, I only get one line in the log:
127.0.0.1 - - [04/May/2015:13:21:25 +0000] "POST /stuff HTTP/1.1" 422 370 232 232
HTTP 422 is not an unreasonable hint, but I must believe there was a more detailed message to be had here. Similarly, if a header is missing or path component doesn't match the provided format, I should like to see a log line like "Header ____ could not be parsed".
127.0.0.1 - - [04/May/2015:13:21:25 +0000] Received "POST /stuff HTTP/1.1"
127.0.0.1 - - [04/May/2015:13:21:25 +0000] Error: Body could not be parsed (Failure while deserializing field "a")
127.0.0.1 - - [04/May/2015:13:21:25 +0000] "POST /stuff HTTP/1.1" 422 370 232 232
Is such logging built into DropWizard? How can I enable it?