This example will show how the content of the requests and responses for the web API can be logged. Because the content of API requests and responses may contain sensitive data, this information is can only be logged to a table in the ODS database to which that handled the API call was directed. Logging the full content of the API transactions Furthermore, the duration for which this logging can be enabled is limited because it has the potential to generate a large amount of data, so the duration for which this can be enabled is limited.
The steps to enable web API request/response logging can be summarized as:
Table of Contents | ||||
---|---|---|---|---|
|
...
Because the content of an API transaction may contain sensitive data, the only supported storage for logging the content of the transaction is the ODS database which was used to process it. This ensures that the same level of security provided for the data at rest in the ODS database app also applies to the data stored in the log entries as well.The required table can be created by running the following SQL script on the ODS database:
...
The log4net configuration for EdFi.Ods.WebApi needs to must be updated to include the settings needed for request/response content logging.
Add the following elements inside the root <log4net>
element of the active log4net configuration file in use for the web API, typically either log4net.development.config or log4net.config.
Info |
---|
By default, only requests that result in an exception are logged. To log the request/response content of all calls to the web API, change |
Using MS SQL Server
...
Update the following setting in the appsettings.json for EdFi.Ods.WebApi to reflect the number of minutes request/response content should be logged. The measurement of this logging duration begins when the first web API request is received after the application startup of the application.
Code Block | ||
---|---|---|
| ||
"LogRequestResponseContentForMinutes": 0 |
...