How to log all routes in NextJS

This use-case sounds like an access-log setup.

The best way would be to setup a reverse proxy like nginx so it can create logs in your docker container.

If you don't want to do that, you can follow these two steps

  1. Setup a custom server that gets the request https://nextjs.org/docs/advanced-features/custom-server
  2. Use something like https://www.npmjs.com/package/next-bunyan to write out your logs

If you would like access from the front-end to be logged as well as they traverse the application - You could use something like a Google analytics account to capture both client and server side events.