Hi there. I have a deployed rails app. Logs are located in log/production.log, which I don’t think I’ve configured anywhere.
I can do fly ssh console and tail -f log/production.log to see my logs, but I don’t see them in my Fly monitoring dashboard or via fly logs. All I see there is about my server spinning up or down and listening.
I’m under the impression that I should see them from this section - is this wrong?
I could use RAILS_LOG_TO_STDOUT, but I’d like to get the log file working. My fly.toml doesn’t have any details around logging or any env vars.
Let me know what other info is needed to help out.
Logging to standard out is how you route your logs to the monitoring dashboard and fly logs. This is configured in config/environments/production.rb. If you like you can tell Rails to log to both stdout and log/production.log. More information can be found in Multiple Logs for Resiliency · The Fly Blog
Do you think it’s worth adding RAILS_LOG_TO_STDOUT in the env of the generated fly.toml for rails projects? I might have messed something up when setting up my project, but it’s been a bit annoying to not log to the dashboard by default.
For reference, this is in my (rails 7) generated production.rb
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end