By kkaliannan24
I followed the tutorial (https://www.digitalocean.com/community/articles/how-to-use-the-dokku-one-click-digitalocean-image-to-run-a-ruby-on-rails-app) to get my rails app up and running with dokku.
When I do: dokku logs APP_NAME, all that I see are three lines corresponding to the server starting, so my logs aren’t being written to properly. How can I debug this? Common reasons my app isn’t writing production logs?
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You have to redirect logs to Stdout, so edit config/environments/production.rb properly:
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
Hint: maybe you need the Lograge gem too.
Do you have any logging related values set in <code>config/environments/production.rb</code> ? The default should be: <pre> config.log_level = :info RAILS_DEFAULT_LOGGER = Logger.new(‘log/production.log’) </pre> Make sure you haven’t used <code>SyslogLogger</code> as that will log to the OS syslog, not a separate Rails app log, and Dokku won’t find it.
If you need to dig around in the container itself to debug and make sure the log is actually being created, you can run: <pre> dokku run app_name ‘/bin/bash’ </pre>
Okay I fixed the rails c problem, but the logs debacle still remains unfortunately. Do you know of any other alternatives for generating logs I can use in the meantime?
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.