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

Monkey patch log_error - format errors on one line #147

Merged
merged 7 commits into from
May 15, 2020

Commits on May 14, 2020

  1. Add a basic test of the default rails logger

    Co-authored-by: Richard Towers <[email protected]>
    callumknights and richardTowers committed May 14, 2020
    Configuration menu
    Copy the full SHA
    eb9b74a View commit details
    Browse the repository at this point in the history
  2. Test DebugExceptions middleware logs to stderr

    This test shows that errors raised by the application are logged by this
    middleware, but it doesn't make any assertions about their format
    (because we haven't fixed that yet).
    
    Co-authored-by: Richard Towers <[email protected]>
    callumknights and richardTowers committed May 14, 2020
    Configuration menu
    Copy the full SHA
    b4cf616 View commit details
    Browse the repository at this point in the history
  3. Use rack test to test the whole rails app

    ... instead of just the middleware
    richardTowers committed May 14, 2020
    Configuration menu
    Copy the full SHA
    c7d4a8c View commit details
    Browse the repository at this point in the history

Commits on May 15, 2020

  1. Monkey patch log_error - format errors on one line

    It's annoying having Rails log errors across multiple lines, as it makes
    indexing them in logstash very difficult.
    
    Instead, we can 🐒 patch the private log_error method in
    ActionDispatch::DebugExceptions so that the log format is a bit nicer.
    We're logging errors as JSON because it's easy to do, and should be easy
    to parse later in the logstash filters.
    
    It's worth us being very careful not to monkey patch this method if it
    doesn't look the way we expect it to - it's not part of the public
    interface of rails, so it could change in a future version without
    warning. To help avoid this, `should_monkey_patch_log_error` check that
    the method we're patching has the expected set of parameters, and we
    won't replace the method unless it does.
    
    There's also a test in this gem that now checks that errors raised by
    the application are logged as JSON, so that should catch any regressions
    in future versions of ActionDispatch.
    richardTowers committed May 15, 2020
    Configuration menu
    Copy the full SHA
    466324f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2ff938a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0359491 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    44f11c3 View commit details
    Browse the repository at this point in the history