How to console.log from a custom server in nextjs

Viewed 5407

I have a nextjs app with a custom server to cache and fix urls. Is there any way to console.log, or any other logging, to debug? Next.js automatically clears the screen so any logs are erased.

I have found that there is a config option to stop the automatically clearing but couldn't figure out how to write it in the "next.config.js" file.

1 Answers

try adding this whenever you call const app = next({ dev });

add preserve log like this:

const app = next({ dev, preserveLog: true });.

Related