Hi,
I am using the CsvRequestLogger to log each request to the filesystem.
Due to logging the whole response the log lines could get really long.
Is there a way to set a limit for log lines?
Greetings
Andre
Hi,
I am using the CsvRequestLogger to log each request to the filesystem.
Due to logging the whole response the log lines could get really long.
Is there a way to set a limit for log lines?
Greetings
Andre
You can customize what gets saved by registering a RequestLogFilter
:
Plugins.Add(new RequestLogsFeature {
RequestLogFilter = (req,logEntry) => ...
});
But if you only log a partial Request/Response you’ll break deserialization which will prevent being able to view latest logs with GetLatestLogs()
.
Best to limit which responses are logged by using the available configuration options, e.g:
Another option is to use an external framework like NLog which I’ve been using for over a decade in all my projects. I log from PreRequestFilters, GlobalResponseFilters and ServiceExceptionHandlers. Advantage is you can really format the output to your heat’s content. Downside is you’ll lose the GetLatestLogs, etc that’s built in to ServiceStack.