Skip to content

Commit

Permalink
Document configuring a different log formatter, #6
Browse files Browse the repository at this point in the history
  • Loading branch information
markhobson committed Jul 28, 2018
1 parent 6541dc3 commit 3873896
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ RestTemplate restTemplate = new RestTemplateBuilder()
.build();
```

### Customising the log format

To use a different format when logging HTTP traffic, implement `LogFormatter` and pass it to the customizer:

```java
RestTemplate restTemplate = new RestTemplateBuilder()
.customizers(new LoggingCustomizer(LogFactory.getLog(LoggingCustomizer.class), new MyLogFormatter()))
.build();
```

Consider subclassing `DefaultLogFormatter` and overriding `formatBody` if you only need to customise the logged HTTP
body.

## Acknowledgements

Thanks to [@nwholloway](https://github.com/nwholloway) and [@hdpe](https://github.com/hdpe) for the original
Expand Down

0 comments on commit 3873896

Please sign in to comment.