How do I log request to the Content Delivery API
# help-with-umbraco
t
I need to find a way log any request via the content delivery API. Is there any easy way to do this? Do I perhaps have to extend some controller to do this?
w
Would web server logs be an option, if they're accessible? They might not have the full level of detail you want though
t
Maybe yes, our need is mainly only for local development at the moment, and we're running
dotnet run
so it's Kestrel I assume. Maybe there's a way to log every request to Umbraco? That could suffice for sure.
I don't know enough about the Asp.NET framework yet
w
You could check the existing Umbraco trace log files too, they're under Umbraco/logs (or should be)
t
s
Out of curiosity can I ask what the purpose of this logging is?
t
It's for debugging and verifying correct behavior from our NextJS, on how it handles caches. To know when certain caches are invalidated and thus requested anew from the API.
s
If you just need to know when a page in Umbraco is updated so you can invalidate caches, use webhooks. Maybe I'm reading this wrong though, but all of this sounds overly complicated and not like something other people seem to be doing.
t
We use notifications for this, but yes webhooks could work as well (although we couldn't find all the webhooks we need, it was either when moving stuff to recycle bin or something similar so that is not an option). The need for logging was temporary during development only, to verify what NextJS was actually doing. To see whenever it was actually doing requests to the API, and to see when it was using its internal cache. Umbraco was behaving. NextJS was - as it often is when it comes to caching - being "mysterious" and magical, the developer nightmare 😄
2 Views