Where are my Node.js or Python app's error logs?
Start with the Passenger log
Node.js and Python applications run through Phusion Passenger.
The application screen includes a Passenger log file setting. Set it to a file inside your application root, for example:
/home/USERNAME/APPROOT/passenger.log
Replace USERNAME and APPROOT with your account and application details.
Then:
- Save the application settings.
- Restart the application.
- Open the affected URL to reproduce the error.
- Check the log file again.
Keep log files outside public_html so visitors cannot download them.
The file appears once the app writes to it.
Check the domain error log
The web server's error log may contain problems that occur before Passenger starts the application.
cPanel
- Sign in to cPanel.
- Open Metrics.
- Select Errors.
- Look for entries matching the time you reproduced the problem.
DirectAdmin
Open System Info & Files → Site summary & logs and view the domain's error log.
Most DirectAdmin servers use OpenLiteSpeed and cannot run these Passenger applications. If you are unsure which server you use, open a support ticket before troubleshooting further.
Check Python's stderr.log
Some Python applications or Passenger configurations write errors to stderr.log in the application root.
Check for:
/home/USERNAME/APPROOT/stderr.log
If the file does not exist, use the configured Passenger log and domain error log instead.
Write useful application errors
Python applications should use Python's logging module or write errors to standard error.
Node.js applications can write errors with:
console.error("An error occurred");
Avoid logging passwords, API keys, cookies or complete database connection strings.
Read logs over SSH
To display the latest 100 lines of a log:
tail -n 100 passenger.log
To watch new entries while reproducing the problem:
tail -f passenger.log
Press Ctrl+C to stop watching.
Run these commands from the application root, or provide the full path to the log.
Common errors
| Log message or symptom | What to check |
|---|---|
ModuleNotFoundError or ImportError |
Activate the Python virtual environment and install the required package |
Cannot find module |
Install the Node.js dependencies in the correct application environment |
| WSGI application cannot be loaded | Check passenger_wsgi.py and its import path |
| Startup file not found | Check the configured startup file and application root |
| Permission denied | Check file and folder permissions |
| Database connection failed | Check the database host, name, user, password and environment variables |
| Application returns 500 after an update | Review recent code, dependency and environment changes |
| Old code still runs | Restart the application |
| App never starts on DirectAdmin | Ask Webway whether the server uses a compatible Apache setup |
Check for the placeholder page
If the log remains empty and you see a default hosting page, check for:
public_html/index.html
A new account's placeholder index.html can be served instead of the application. Delete it only if it is the default placeholder and not part of another website.
Do not remove the Passenger configuration written to public_html/.htaccess.
Check the application limits
The default application limits are:
| Resource | Default limit |
|---|---|
| Memory | 2 GB |
| Simultaneous requests | 30 |
| Processes | 90 |
An application may fail, restart or return an error if it exceeds an available resource. Look for memory, process or request-limit messages around the time of the failure.
Still stuck?
Open a support ticket and include:
- Your domain or application URL
- Whether the app uses Node.js or Python
- Whether you use cPanel or DirectAdmin
- The selected runtime version
- The application root and startup file
- The exact error shown in the browser
- Relevant Passenger and domain error-log entries
- The date and approximate time you reproduced the problem
- What changed immediately before the error began
Did this answer it?