hdpe / spring-rest-template-logger

Spring RestTemplate customizer to log HTTP traffic.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring RestTemplate Logger

Spring RestTemplate customizer to log HTTP traffic.

Getting started

Add a dependency to your Maven project:

<dependency>
	<groupId>org.hobsoft.spring</groupId>
	<artifactId>spring-rest-template-logger</artifactId>
	<version>1.0.0</version>
</dependency>

Customize your RestTemplate as follows:

RestTemplate restTemplate = new RestTemplateBuilder()
	.customizers(new LoggingCustomizer())
	.build()

Now all RestTemplate HTTP traffic will be logged to org.hobsoft.spring.resttemplatelogger.LoggingCustomizer at debug level:

21:14:53.688 [main] DEBUG org.hobsoft.spring.resttemplatelogger.LoggingCustomizer - Request: GET http://www.hobsoft.org/ 
21:14:53.892 [main] DEBUG org.hobsoft.spring.resttemplatelogger.LoggingCustomizer - Response: 200 <!DOCTYPE html>
<html>
	<head>
		<title>Hobsoft</title>
...

Acknowledgements

Thanks to @nwholloway and @hdpe for the original implementation.

License

Build Status

About

Spring RestTemplate customizer to log HTTP traffic.

License:Apache License 2.0


Languages

Language:Java 100.0%