Commits

Robert Brewer  committed 7f4c6b7

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

  • Participants
  • Parent commits 8ebb9da
  • Branches cherrypy-3.1.x

Comments (0)

Files changed (1)

File cherrypy/__init__.py

 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)