Commits

Robert Brewer  committed adce8ee

Fix for #747 (log.screen should send error log messages to stderr).

  • Participants
  • Parent commits 50decf0

Comments (0)

Files changed (1)

File cherrypy/_cplogging.py

     
     # ------------------------- Screen handlers ------------------------- #
     
-    def _set_screen_handler(self, log, enable):
+    def _set_screen_handler(self, log, enable, stream=None):
         h = self._get_builtin_handler(log, "screen")
         if enable:
             if not h:
-                h = logging.StreamHandler(sys.stdout)
+                if stream is None:
+                    stream=sys.stdout
+                h = logging.StreamHandler(stream)
                 h.setLevel(logging.DEBUG)
                 h.setFormatter(logfmt)
                 h._cpbuiltin = "screen"
         return bool(has_h)
     
     def _set_screen(self, newvalue):
-        self._set_screen_handler(self.error_log, newvalue)
+        self._set_screen_handler(self.error_log, newvalue, stream=sys.stderr)
         self._set_screen_handler(self.access_log, newvalue)
     screen = property(_get_screen, _set_screen,
                       doc="If True, error and access will print to stdout.")