Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs not printing to STDOUT #28

Closed
sudhirj opened this issue Oct 24, 2018 · 4 comments
Closed

Logs not printing to STDOUT #28

sudhirj opened this issue Oct 24, 2018 · 4 comments

Comments

@sudhirj
Copy link

sudhirj commented Oct 24, 2018

Apps with the rails_12factor gem / apps running on Heroku need to print logs to STDOUT - but falcon seems to be blocking this. On Heroku it dumps the logs only on exit. Can we have logging behaviour respected / flushed when the app is trying to log to STDOUT?

@ioquatix
Copy link
Member

Thanks for the report.

I'm not completely sure I understand the problem.

I'm running a demo app in Heroku and the logs come out just fine:

screen shot 2018-10-25 at 9 10 00 am

So, I don't believe logging goes to STDOUT but goes to STDERR:

https://github.com/socketry/async/blob/master/lib/async/logger.rb#L42

Do you mind showing me how you are starting falcon (do you include --verbose) and do you mind showing me the log output window on Heroku after running some requests?

@sudhirj
Copy link
Author

sudhirj commented Oct 25, 2018

screenshot 2018-10-25 at 9 32 01 pm

Here's what I mean - only the Heroku router logs are shown when the requests are made, but when I restart and SIGTERM is sent, all the logs are dumped.

This is the Rails 5.2.1 with the RAILS_LOG_TO_STDOUT=enabled, with the default production.rb settings.

if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger    = ActiveSupport::TaggedLogging.new(logger)
end

@sudhirj
Copy link
Author

sudhirj commented Oct 25, 2018

Not using verbose mode, start command is web: bundle exec falcon serve --port $PORT --bind http://0.0.0.0

@ioquatix
Copy link
Member

I just deployed the latest version of falcon and https://github.com/socketry/utopia-falcon-heroku to Heroku and the logging is certainly happening in real time as I make individual requests.

I took a look at rails_12factor and see that it pulls in the following code:

https://github.com/heroku/rails_stdout_logging/blob/master/lib/rails_stdout_logging/rails.rb#L2-L4

It seems to me that it's likely to stop ::Logger from working correctly. I'd say the issue here is not with Falcon (which uses ::Logger) and with rails_stdout_logging which is breaking ::Logger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants