Add Logging (to a DB) to Service Stack Service

Viewed 392

I am new to Service Stack and have created my first service to replace a WebAPI service. The service will be readonly and will mostly be consumed with the JsonServiceClient. I'm using version 4 of Service Stack.

I have a requirement to log several things about each request to a database - request variables (HTTP_USER_AGENT, LOGON_USER, etc.), the response code, response content type, the response time (ms), number of records returned (if applicable), etc.

I'm looking for some "global" way of achieving this (without putting a lot of code in each service/method).

Has anyone done this kind of logging before?

2 Answers
Related