Log file
Relevant selection for this article:
Passenger logs all its messages to a log file. Inside this log file you will find informational messages, errors, warnings and debugging messages generated by Passenger, as well as application output. Whenever Passenger wants to tell you something, it is done through this log file, so you should check this file whenever you suspect that something is wrong.
This guide teaches you where to find the log file, how to customize its location and verbosity, and teaches you other miscellaneous things that you should know.
Table of contents
- Loading...
Location of the log file
By default, the Passenger log file is the global Nginx error log file. This is one specified by the error_log
directive in the main context (that is, not the one inside the http
context). The file is typically located in /var/log/nginx/error.log
.
Or, if you configured the passenger_log_file directive, then the log file is in the referenced file.
Application output logging
Stdout and stderr
Everything that the application writes to the stdout and stderr channels is logged to the log file at log level 3 (the default log level for Passenger).
Application log
The application or web framework may have its own log file that is independent from the Passenger log file. You should also check that file to see whether your application or web framework has logged any important messages.
For example, Ruby on Rails logs to log/development.log
and log/production.log
. When an error occurs during request handling, it is typically logged here. Note that this file does not contain errors that Rails encounters during startup – those kinds of errors are typically written to stderr, which means they end up in the Passenger log instead.
Note that Passenger runs applications in the "production" environment by default (that is, Passenger sets RAILS_ENV
, RACK_ENV
, NODE_ENV
and related environment variables "production"). So if you're using Rails, please be sure to check production.log
instead of development.log
.
Customizing the log file
You can instruct Passenger to log to a specific log using the passenger_log_file option.
By default, Passenger only prints important informational messages, warnings and errors. You can configure Passenger to log less important messages too, such as debugging messages, through passenger_log_level.
Troubleshooting logging problems
Messages may get lost by log rotation problems
Is your Passenger log file the Nginx error log? And do you not find anything useful inside it, while at the same time it looks like Passenger stopped logging to the file quite some time ago? Then you probably have a log rotation problem, causing logs to get lost. Please configure Passenger log rotation.
Application stdout/stderr problems
Are you expecting to find application output in the log file, but don't actually see it? Then the cause may be that the application has modified stdout and stderr. Learn more about this.
Try raising the log level
Sometimes there's actually nothing wrong with the log file. Try raising the log level so that you see more messages.