Bug 808581 - Stack traces logged to production.log for user-level validation errors
Stack traces logged to production.log for user-level validation errors
Status: CLOSED UPSTREAM
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Content Management (Show other bugs)
6.0.0
Unspecified Unspecified
unspecified Severity medium (vote)
: Unspecified
: --
Assigned To: Petr Chalupa
Katello QA List
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-30 14:44 EDT by Jeff Weiss
Modified: 2015-05-04 21:30 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-19 14:12:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Jeff Weiss 2012-03-30 14:44:37 EDT
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 04:36:35 EDT
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 05:14:23 EDT
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 08:23:46 EDT
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 13:00:25 EDT
addressed in:

https://github.com/Katello/katello/pull/176
Comment 6 Petr Chalupa 2012-10-05 02:58:38 EDT
fixed in aec316257d8fe36e1e01462fa889bfb5ad0556ab
Comment 7 Mike McCune 2013-09-19 14:12:47 EDT
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.