How do you turn off console logging for your api route requests??
Answered
Irish Red and White Setter posted this in #help-forum
Irish Red and White SetterOP
When developing I always see all requests to api routes. For example I have hundreds of these directly output to console due to apollo:
This breaks my ability to read actual important logs.
Documentation here https://nextjs.org/docs/app/api-reference/next-config-js/logging says that you can:
Sure.. but that doesn't work:
Is the solution to modify the actual nextjs files in
POST /api/graphql/ 200 in 38msThis breaks my ability to read actual important logs.
Documentation here https://nextjs.org/docs/app/api-reference/next-config-js/logging says that you can:
module.exports = {
logging: false,
}In addition, you can disable the development logging by setting logging to false.
Sure.. but that doesn't work:
⚠ Invalid next.config.js options detected:
⚠ Expected object, received boolean at "logging"
Is the solution to modify the actual nextjs files in
node_modules?Answered by joulev
that option should work in canary. afaik in stable nextjs releases, it's not possible to opt out of that logging
4 Replies
@Irish Red and White Setter When developing I always see all requests to api routes. For example I have hundreds of these directly output to console due to apollo:
`POST /api/graphql/ 200 in 38ms`
This breaks my ability to read actual important logs.
Documentation here https://nextjs.org/docs/app/api-reference/next-config-js/logging says that you can:
module.exports = {
logging: false,
}
> In addition, you can disable the development logging by setting logging to false.
Sure.. but that doesn't work:
> ⚠ Invalid next.config.js options detected:
> ⚠ Expected object, received boolean at "logging"
Is the solution to modify the actual nextjs files in `node_modules`?
that option should work in canary. afaik in stable nextjs releases, it's not possible to opt out of that logging
Answer
@joulev that option should work in canary. afaik in stable nextjs releases, it's not possible to opt out of that logging
Irish Red and White SetterOP
Is the documentation for canary?
@Irish Red and White Setter Is the documentation for canary?
the documentation is indeed on canary versions yeah – it doesn't make much sense but don't ask me why.
though to be fair to them, they do edit the documentation to make it clear which part is for stable and which part is for canary. they forgot to update that for this instance, however.
though to be fair to them, they do edit the documentation to make it clear which part is for stable and which part is for canary. they forgot to update that for this instance, however.
@joulev the documentation is indeed on canary versions yeah – it doesn't make much sense but don't ask me why.
though to be fair to them, they do edit the documentation to make it clear which part is for stable and which part is for canary. they forgot to update that for this instance, however.
Irish Red and White SetterOP
Ok thanks, at least I know now!