1. Eric Larson
  2. CherryPy


Robert Brewer  committed 5ba0a8c

Fix for #945 (GlobalLogManager swaps errors outside of requests) for all active 3.x heads.

  • Participants
  • Parent commits 95dd968
  • Branches cherrypy-3.0.x

Comments (0)

Files changed (1)

File cherrypy/__init__.py

View file
 class _GlobalLogManager(_cplogging.LogManager):
     def __call__(self, *args, **kwargs):
-        try:
+        # Do NOT use try/except here. See http://www.cherrypy.org/ticket/945
+        if hasattr(request, 'app') and hasattr(request.app, 'log'):
             log = request.app.log
-        except AttributeError:
+        else:
             log = self
         return log.error(*args, **kwargs)