How To Implement logRequestResponse in Spray


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


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s