The official Express web server documentation explains why using console.log or console.error isn't recommended for real-production web applications.
In general, there are two reasons for logging from your app--for debugging and for logging app activity (essentially, everything else). Using console.log() or console.error() to print log messages to the terminal is a common practice in development. However, these functions are synchronous when the destination is a terminal or a file, so they are not suitable for production, unless you pipe the output to another program. For more information, visit the following link:
https://expressjs.com/en/advanced/best-practice-performance.html
https://expressjs.com/en/advanced/best-practice-performance.html