What error log level should I use in production?
Use 'warn' for production. It logs warnings and errors without filling the disk with debug info. Use 'debug' only temporarily when troubleshooting specific issues. Use 'error' if you want only errors, but 'warn' catches potential problems early.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Nginx Logging and Debugging Access Logs, Error Logs, and Troubleshooting
Access logs are at /var/log/nginx/access.log (every HTTP request) and error logs are at /var/log/nginx/error.log (errors and warnings). View in real-time with sudo tail -f /var/log/nginx/access.log or /var/log/nginx/error.log.
Define log_format in nginx.conf with variables like $request_time (total request time), $upstream_connect_time (time to connect to Node.js), and $upstream_response_time (Node.js response time). Then use access_log /path/to/log main; to apply it.
Check sudo tail -20 /var/log/nginx/error.log for the error cause. Verify Node.js is running with pm2 status. Check that the proxy_pass port matches the Node.js port. Restart both Nginx and PM2 if needed.
Still have questions?
Browse all our FAQs or reach out to our support team
