I can use CsvRequestLogger to log the incoming REST Requests. Is there any way to log also the responses?
RequestLogger = new CsvRequestLogger() { EnableResponseTracking = true, EnableRequestBodyTracking = true, EnableErrorTracking = true, EnableSessionTracking = true}
What does ResponseTracking do?
If EnableResponseTracking
is enabled request logger adds response DTO to log entry (to RequestLogEntry.ResponseDto
property) and if the response is error it logs error and exception as well (it sets RequestLogEntry.ErrorResponse
, StatusCode
, StatusDescription
and ExceptionSource
and ExceptionData
if exception occures)
Are there any special attributes required for the DTO? For me, the exceptions are logged, but no DTO is ever recorded.
The CSV has a blank entry for the ResponseDto
OK I found the cause
This works and logs properly
Plugins.Add(new RequestLogsFeature
{
RequestLogger = new CsvRequestLogger(),
EnableResponseTracking = true,
EnableRequestBodyTracking = true,
EnableErrorTracking = true,
EnableSessionTracking = true
});
but this does NOT work
Plugins.Add(new RequestLogsFeature
{
RequestLogger = new CsvRequestLogger(){
EnableResponseTracking = true,
EnableRequestBodyTracking = true,
EnableErrorTracking = true,
EnableSessionTracking = true
}});