I have a spring boot project and using logbook library for logging requests and responses.
In one of the REST API services, One of the properties data type is byte[], So when the client sends the request, because of that data type it prints a lot of log in the console and that is not what I wanted.
I have seen in the document that you can exclude some path or content type, but not by name or data types.
Here how document suggest for configuration:
Logbook logbook = Logbook.builder()
.condition(exclude(
requestTo("/health"),
requestTo("/admin/**"),
contentType("application/octet-stream"),
header("X-Secret", newHashSet("1", "true")::contains)))
.build();
The tmarwen answer is good, but I suppose you want to ignore just specific properties or data types and not an HTTP content type. In case that is true, Then you can do as following to ignore specific property by name :
Or
Here is a full example from the documentation :
Suppose you have a request like :
By applying these configurations :
Turn into :