8 months ago
Hi Railway Support,
After a recent deployment, application logs stopped appearing in the Railway console. We only see PostgreSQL checkpoint logs; no HTTP access logs or application logs (INFO/ERROR) are visible.
Our Procfile includes --access-logfile - and our Python logger uses StreamHandler(sys.stdout), but nothing appears in the console.
Has Railway changed how logs are captured or displayed? Any guidance would be appreciated.
Thank you.
3 Replies
8 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open Railway • 8 months ago
8 months ago
Have you looked at other Logs - Network or deploy logs? do they come for you? Maybe more of an application issue?
(Info could be wrong, just trying to help!)
2 days ago
AI-assisted; reviewed against current Railway, Gunicorn and Python docs. I tested logger-level behavior locally, not your deployment.
Railway still captures stdout/stderr. PostgreSQL checkpoint lines alone do not establish that your backend process is emitting logs.
- Open the backend service’s active deployment → Deploy Logs, select a current time range and clear filters. Confirm the effective Start Command actually runs the Gunicorn command from your Procfile; an overridden command or Docker entrypoint can make the Procfile irrelevant.
- If Gunicorn is the process being launched, keep your existing app target/worker/bind settings and add --access-logfile - --error-logfile - --log-level info. Access logging and application logging are separate; those flags do not set your application logger’s level. Generate one ordinary request to a known safe route, then check for its access line.
- StreamHandler(sys.stdout) selects a destination but does not enable INFO messages. In your existing logging configuration, ensure both the application logger’s effective level and its handler level allow INFO; also check disabled, filters, and propagation. For a standalone logger configuration:
import logging, sys
logger = logging.getLogger("your_application")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
logger.addHandler(handler) # only if an equivalent handler isn't already installedPut configuration before the first application log; avoid duplicate handlers and do not log credentials or request bodies. PYTHONUNBUFFERED=1 helps buffered print output, but cannot fix a logger filtering INFO.
If access/error output appears but app messages do not, focus on application logging. If neither appears, share the redacted effective start command and backend deployment timestamp; that separates process/configuration issues from log ingestion without assuming a platform incident.
https://docs.railway.com/observability/logs
17 hours ago
Hi there!
When running a Python WSGI app (like Flask or Django) with Gunicorn on Railway, application logs (INFO) and access logs often disappear or fail to show up for a few distinct reasons: Gunicorn's default log level threshold, unbridged Python log handlers, output buffering, or service view selection.
Here is how to resolve it completely:
Step 1: Update your Gunicorn Start Command
Ensure your Procfile or Railway start command explicitly streams access and error logs to standard output/error, and lowers the log level (default is warning, which hides info logs):
web: gunicorn --bind 0.0.0.0:$PORT --access-logfile - --error-logfile - --log-level info wsgi:app
(Replace wsgi:app with your actual module and app instance).
Step 2: Bridge Python Logging to Gunicorn (Crucial for INFO/ERROR app logs)
Gunicorn sets up its own logging configuration that often detaches standard Python loggers. If you use Python's built-in logging module inside your app, add this snippet to your application entry point (e.g., wsgi.py or app.py) so app logs inherit Gunicorn's handlers:
import logging
if name != 'main':
gunicorn_logger = logging.getLogger('gunicorn.error')
app.logger.handlers = gunicorn_logger.handlers
app.logger.setLevel(gunicorn_logger.level)
# Optional: sync root logger as well
logging.getLogger().handlers = gunicorn_logger.handlers
logging.getLogger().setLevel(gunicorn_logger.level)Step 3: Set PYTHONUNBUFFERED=1
In your Railway service Variables tab, add:
- Key: PYTHONUNBUFFERED
- Value: 1
This stops Python from buffering standard streams in container environments, ensuring logs stream to the console instantly.
Step 4: Verify Your Railway Dashboard View
Since you mentioned seeing only PostgreSQL checkpoint logs, double-check that you have selected your Web Service deployment logs in the Railway Log Explorer rather than your PostgreSQL database service logs.
References
- Gunicorn Settings (--log-level, --access-logfile)
- Flask Deployment with Gunicorn Documentation
Disclosure: I used AI assistance to help prepare this response and reviewed the technical reasoning before submitting.