I have a next.js application running in an Azure container app.
The container app has a "log stream" feature. In this view I can see that the next.js application is starting up:
▲ Next.js 14.2.3
- Local: http://localhost:3000
- Network: http://0.0.0.0:3000
✓ Starting...
✓ Ready in 75ms
This looks almost identical to the output when I run locally.
After this I expect a lot of log entries from my own code. But nothing more shows up in the log. When I run locally, the logging from my own code is working fine.
I am simply using console.log(). I have also tried console.info(), console.error(). I found the next.js framework code that I believe logs the lines above. They seem to be using console.log().
Is my code running as a child process and do I have to do something actively to pipe the stdout and stderror so they will show up in the output?
2
Answers
It takes up to 60 Seconds to get the logs in log stream.
You can follow the same approach as below to get the requirement done
I have created sample Next.js application and added sample log in the code.
npx create-next-app@latest my-nextjs-app
.I have pushed the application into azure container registry successfully. check below:
After running the application with container app URL getting like below:
In log stream getting the error logs successfully. check below:
Output:
In the end you can see the Error logs after 60 seconds.
Did you ever find the answer? I’m having the same problem.