Category Archives: Response

How To Implement logRequestResponse in Spray


Knoldus

Spray has the feature to log request and response of every route through logRequestResponse. We needn’t to add log in each route because it could be done from a single place. This also helps to maintain clean code.
Please see below example:-

Now execute sbt run, run the http://localhost:8080/module/BANG from browser and see the log in console.

We could change log format and level, depending on the requirement. For complete example, you can pull the code from spray-akka-starter.

View original post

Advertisements