Skip to content

including gem but setting HerokuRequestId::Middleware.log_line to false in development causes errors #3

Description

@bodaro

If I use this gem during local development (not on heroku) I see this as part of the logs for each request:

2013-09-16 00:05:20 [FATAL]
ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5 seconds. The max pool size is currently 5; consider increasing it.):

I cannot conditionally include the gem because I sometimes run a staging or production RAILS_ENV from my local environment (aka laptop).

I am hoping that setting log_line to false would mean the gem does nothing and stops making these strange errors.

Also, I would really like to see not only a log line showing the heroku request ID but also the current request session ID (from the session cookie) so I can track a given user across requests (would be super awesome in papertrail).

Further, I would also love to have the heroku request ID and the session ID appeneded to each and every heroku log line. Is this possible?

Here is my logs showing the error (with more context):

Started GET "/en/contests" for 127.0.0.1 at 2013-09-16 00:10:28 -0700
2013-09-16 00:10:28 [DEBUG] DfcBase::ApplicationController module is being included
2013-09-16 00:10:29 [INFO ] Processing by ContestsController#index as HTML
2013-09-16 00:10:29 [INFO ] Parameters: {"locale"=>"en"}
2013-09-16 00:10:29 [DEBUG] DfcBase::ApplicationController.set_current_user: looking for user from session user_id:
2013-09-16 00:10:29 [DEBUG] User Load (0.4ms) SELECT users.* FROM users WHERE users.id IS NULL LIMIT 1
2013-09-16 00:10:29 [DEBUG] DfcBase::ApplicationController.set_current_user: User from session is ID: , Email: , First Name: , Active: true, Email Valid: false, roles: , username:
2013-09-16 00:10:29 [DEBUG] DfcBase::ApplicationController.set_current_user: user is ID: , Email: , First Name: , Active: true, Email Valid: false, roles: , username:
2013-09-16 00:10:29 [INFO ] ApplicationController.capture_session_info: setting locale to en
2013-09-16 00:10:29 [DEBUG] DfcBase::Metric.count: Counted for table requests. Data: {"type"=>"server", "uid"=>nil, "path"=>"/en/contests", "url"=>"http://localhost:3000/en/contests", "host"=>"localhost", "query_string"=>"", "content_type"=>"text/html", "method"=>"GET", "xhr"=>false, "controller"=>"contests", "action"=>"index", "driver"=>nil, "user_agent"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20100101 Firefox/23.0", "countable"=>true}
2013-09-16 00:10:29 [DEBUG] Setting Load (0.3ms) SELECT settings.* FROM settings LIMIT 1
2013-09-16 00:10:29 [DEBUG] ApplicationController.has_role?: checking for role content for user ID: , Email: , First Name: , Active: true, Email Valid: false, roles: , username:
2013-09-16 00:10:29 DEBUG SELECT COUNT(*) FROM contests WHERE (status = 'published' AND start_date <= '2013-09-16 07:10:29' AND end_date >= '2013-09-16 07:10:29')
2013-09-16 00:10:29 [INFO ] Rendered contests/frontend_index.haml within layouts/contest (13.7ms)
2013-09-16 00:10:30 [DEBUG] default_url_options is passed options: {}
2013-09-16 00:10:30 [DEBUG] EnvHelper.url_path(path=/en/auth/login, prefer_ssl = true): Fully qualified URL is /en/auth/login
2013-09-16 00:10:30 [INFO ] Rendered shared/_header.html.haml (71.8ms)
2013-09-16 00:10:30 [INFO ] Rendered shared/_nav.html.haml (29.2ms)
2013-09-16 00:10:30 [INFO ] Rendered shared/_show_flash.html.haml (1.9ms)
2013-09-16 00:10:30 [INFO ] Rendered shared/_body.html.haml (37.2ms)
2013-09-16 00:10:30 [INFO ] Rendered shared/_footer.html.haml (8.8ms)
2013-09-16 00:10:30 [INFO ] Rendered shared/_pagewrap.html.haml (125.4ms)
2013-09-16 00:10:30 [INFO ] Rendered shared/_facebook_like_script.html.haml (1.7ms)
2013-09-16 00:10:30 [INFO ] Rendered shared/_metrics.html.haml (2.7ms)
2013-09-16 00:10:30 [INFO ] Rendered shared/_tweet_button_script.html.haml (1.6ms)
2013-09-16 00:10:30 [INFO ] Rendered shared/_google_plus_script.html.haml (1.2ms)
2013-09-16 00:10:30 [INFO ] Rendered layouts/application.html.haml (484.9ms)
2013-09-16 00:10:30 [INFO ] Completed 200 OK in 1017ms (Views: 581.1ms | ActiveRecord: 27.4ms)
2013-09-16 00:10:40 [FATAL]
ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5 seconds. The max pool size is currently 5; consider increasing it.):


Mike

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions