[PATCH 2 of 2 v3] changeset: reduce log level of stack trace on innocent exceptions

Thomas De Schampheleire patrickdepinguin at gmail.com
Thu Jun 11 05:44:00 EDT 2015


# HG changeset patch
# User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
# Date 1434003494 -7200
#      Thu Jun 11 08:18:14 2015 +0200
# Node ID a0f1f38814a3c323488a3faa8fbd975e583aa7c5
# Parent  4f3f6762ad6403b42919b61912bd234ad9a488ec
changeset: reduce log level of stack trace on innocent exceptions

When the user performs an unallowed action and a flash is displayed, there
is no need to log the stack trace at 'error' level. Reduce the stack trace
log to debug instead.

diff --git a/kallithea/controllers/changeset.py b/kallithea/controllers/changeset.py
--- a/kallithea/controllers/changeset.py
+++ b/kallithea/controllers/changeset.py
@@ -208,7 +208,7 @@ class ChangesetController(BaseRepoContro
                 raise RepositoryError('Changeset range returned empty result')
 
         except(ChangesetDoesNotExistError,), e:
-            log.error(traceback.format_exc())
+            log.debug(traceback.format_exc())
             msg = _('Such revision does not exist for this repository')
             h.flash(msg, category='error')
             raise HTTPNotFound()
@@ -378,7 +378,7 @@ class ChangesetController(BaseRepoContro
                     dont_allow_on_closed_pull_request=True
                 )
             except StatusChangeOnClosedPullRequestError:
-                log.error(traceback.format_exc())
+                log.debug(traceback.format_exc())
                 msg = _('Changing status on a changeset associated with '
                         'a closed pull request is not allowed')
                 h.flash(msg, category='warning')


More information about the kallithea-general mailing list