diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index 7dae434e07..e6f39970d9 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -212,7 +212,7 @@ def setup(self, cfg): # set gunicorn.access handler if cfg.accesslog is not None: self._set_handler(self.access_log, cfg.accesslog, - fmt=logging.Formatter(self.access_fmt)) + fmt=logging.Formatter(self.access_fmt), stream=sys.stdout) # set syslog handler if cfg.syslog: @@ -373,7 +373,7 @@ def _get_gunicorn_handler(self, log): if getattr(h, "_gunicorn", False): return h - def _set_handler(self, log, output, fmt): + def _set_handler(self, log, output, fmt, stream=None): # remove previous gunicorn log handler h = self._get_gunicorn_handler(log) if h: @@ -381,7 +381,7 @@ def _set_handler(self, log, output, fmt): if output is not None: if output == "-": - h = logging.StreamHandler() + h = logging.StreamHandler(stream=stream) else: util.check_is_writeable(output) h = logging.FileHandler(output)