Edgewall Software

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12632 closed defect (fixed)

TracError while post-processing leads noisy logging — at Version 6

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.14
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

TracError while post-processing is logged without traceback.

API Changes:
Internal Changes:

Description (last modified by Jun Omae)

TracError while executing process_request() is logged with WARNING level and no traceback. However, same exception while post-processing is logged with ERROR level and traceback. That's noisy….

See gmessage:trac-users:4tVRBotYrZs/NB3ZjUYjCAAJ.

  • trac/web/main.py

    diff --git a/trac/web/main.py b/trac/web/main.py
    index 34a43039c..6406f54b3 100644
    a b class RequestDispatcher(Component):  
    280280                except RequestDone:
    281281                    raise
    282282                except Exception, e:
    283                     self.log.error("Exception caught while post-processing"
    284                                    " request: %s",
    285                                    exception_to_unicode(e, traceback=True))
     283                    self.log.error(
     284                        "Exception caught while post-processing request: %s",
     285                        exception_to_unicode(
     286                            e, traceback=not isinstance(TracError, e)))
    286287                raise err[0], err[1], err[2]
    287288        except PermissionError, e:
    288289            raise HTTPForbidden(e)

Change History (6)

comment:1 by Jun Omae, 7 years ago

Or:

  • trac/web/main.py

    diff --git a/trac/web/main.py b/trac/web/main.py
    index 34a43039c..9820472f9 100644
    a b class RequestDispatcher(Component):  
    280280                except RequestDone:
    281281                    raise
    282282                except Exception, e:
    283                     self.log.error("Exception caught while post-processing"
    284                                    " request: %s",
    285                                    exception_to_unicode(e, traceback=True))
     283                    if isinstance(e, TracError):
     284                        self.log.warning("Exception caught while"
     285                                         " post-processing request: %s",
     286                                         exception_to_unicode(e))
     287                    else:
     288                        self.log.error("Exception caught while post-processing"
     289                                       " request: %s",
     290                                       exception_to_unicode(e, traceback=True))
    286291                raise err[0], err[1], err[2]
    287292        except PermissionError, e:
    288293            raise HTTPForbidden(e)
Last edited 7 years ago by Jun Omae (previous) (diff)

comment:2 by Jun Omae, 7 years ago

Description: modified (diff)

comment:3 by Ryan J Ollos, 7 years ago

Yeah, I agree we don't need traceback in case of TracError. I think it could be moved to milestone:next-stable-1.2.x.

comment:4 by Jun Omae, 7 years ago

Milestone: next-stable-1.0.x1.2.1
Owner: set to Jun Omae
Status: newassigned

Okay. I'll push 2nd patch to 1.2-stable branch.

comment:5 by Ryan J Ollos, 7 years ago

I have no problem if you'd like to push to 1.0-stable, I was just thinking that in general we won't be doing as many fixes on that branch since 1.2 is released. I won't get around to releasing 1.0.14 for at least another 24 hours or so, so the change could be included in that release if you felt it was needed.

comment:6 by Jun Omae, 7 years ago

Milestone: 1.2.11.0.14
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks. I reconsider it should be pushed to 1.0-stable. Committed to 1.0-stable in [15290] and merged in [15291-15292].

After [15290], TracError while post-processing is logged like this:

2016-12-07 17:35:17,894 Trac[main] WARNING: Exception caught while post-processing request: TracError: #12632
2016-12-07 17:35:17,894 Trac[main] WARNING: [192.168.11.21] HTTPInternalError: 500 Trac Error (#12632)

Other exceptions while post-processing is logged like this:

2016-12-07 17:38:17,646 Trac[main] ERROR: Exception caught while post-processing request:
Traceback (most recent call last):
  File "/src/tracdev/svn/branches/1.0-stable/trac/web/main.py", line 279, in dispatch
    self._post_process_request(req)
  File "/src/tracdev/svn/branches/1.0-stable/trac/web/main.py", line 403, in _post_process_request
    f.post_process_request(req, *(None,)*extra_arg_count)
  File "/var/trac/1.0-sqlite/plugins/t12632.py", line 12, in post_process_request
    raise TypeError('#12632')
TypeError: #12632
2016-12-07 17:38:17,646 Trac[main] ERROR: Internal Server Error: <RequestWithSession "GET '/about'">, referrer None
Traceback (most recent call last):
  File "/src/tracdev/svn/branches/1.0-stable/trac/web/main.py", line 567, in _dispatch_request
    dispatcher.dispatch(req)
  File "/src/tracdev/svn/branches/1.0-stable/trac/web/main.py", line 259, in dispatch
    self._post_process_request(req, *resp)
  File "/src/tracdev/svn/branches/1.0-stable/trac/web/main.py", line 401, in _post_process_request
    resp = f.post_process_request(req, *resp)
  File "/var/trac/1.0-sqlite/plugins/t12632.py", line 12, in post_process_request
    raise TypeError('#12632')
TypeError: #12632
Note: See TracTickets for help on using tickets.