Logging Cache information in Production/Preview environments #71662
Replies: 2 comments 2 replies
-
Looks like the logRequests function is only included in the dev-server: So logging is probably not possible in the standard nextJs server. You could write a custom server with a custom requestHandler and include the logging there, just as in dev-server. I would also like to have more control on what to log in production without having to build some custom server. |
Beta Was this translation helpful? Give feedback.
-
i suggest you implement opentelemetry and you can log wherever you want :)
|
Beta Was this translation helpful? Give feedback.
-
I am building an application where I use next cache options and the fetch API to cache some requests with the data cache. I am trying to do an investigation into which requests are being cached (certain routes have only a 30% hit rate and I want to see if I'm missing something in production -- it's a 75% hit rate locally)
I'm using the following snippet to get logs in development, but I don't know where to get this in production.
If anyone can point me in the direction of where this config flag turns on logging in the source code, I can probably figure it out from there. Or if anyone just knows if there's a header/something else in the response object, I'd greatly appreciate!
Beta Was this translation helpful? Give feedback.
All reactions