Bug 808581 - Stack traces logged to production.log for user-level validation errors
Summary: Stack traces logged to production.log for user-level validation errors
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Management
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Petr Chalupa
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-03-30 18:44 UTC by Jeff Weiss
Modified: 2019-09-26 13:33 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-19 18:12:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
katello log (117.84 KB, text/x-log)
2012-03-30 18:44 UTC, Jeff Weiss
no flags Details

Description Jeff Weiss 2012-03-30 18:44:37 UTC
Created attachment 574072 [details]
katello log

Description of problem:
The only stacktraces that should be logged are conditions that are unexpected to the developer.  User-level errors like "I tried to create two products with the same name" do not require a stacktrace.  Logs are completely polluted with them.  See attachment.  The only "real" error in there requiring a stacktrace is the JDBC batch update error near the end.

Version-Release number of selected component (if applicable):
CloudForms System Engine Version: 0.1.307-1.el6

How reproducible:
always

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Lukas Zapletal 2012-04-02 08:36:35 UTC
This is more Rails3 "feature" than ours. From all of the reported traces they all go to:

/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/validations.rb:49:in `save!'

When you use method with exclamation mark, you want Rails3 to report the error. Ivan is there a configuration for Rails3 that would not post backtraces?

Comment 2 Ivan Necas 2012-04-02 09:14:23 UTC
The logging of back-trace is in fact handled by Katello itself. For example for Organization creation through UI that is this code:

    # ...
    rescue Exception => error
      # ...
      Rails.logger.error error.backtrace.join("\n")

So the solution would be to update our UI controllers so that it doesn't log trace for validation errors, something like:

    # ...
    rescue Exception => error
      # ...
      Rails.logger.error error.backtrace.join("\n") unless error.is_a? ActiveRecord::RecordInvalid

Notice that API logs stack trace for this kind of error with debug level, which is acceptable/desirable, so that it doesn't pollute the production log, but it still might be helpful in development phase.

Comment 4 Petr Chalupa 2012-06-04 12:23:46 UTC
Imho there should only be:

# ...
rescue ActiveRecord::RecordInvalid
  # ... usually render some error to a user, log nothing
end

Other errors not expected by developer are rescued and logged by rescue_from(StandardError) in application controller.

Comment 5 Mike McCune 2012-08-03 17:00:25 UTC
addressed in:

https://github.com/Katello/katello/pull/176

Comment 6 Petr Chalupa 2012-10-05 06:58:38 UTC
fixed in aec316257d8fe36e1e01462fa889bfb5ad0556ab

Comment 7 Mike McCune 2013-09-19 18:12:47 UTC
These bugs have been resolved in upstream projects for a period of months so I'm mass-closing them as CLOSED:UPSTREAM.  If this is a mistake feel free to re-open.


Note You need to log in before you can comment on or make changes to this bug.