From e8c65c14142bcb6aa1b2485adfa7507859588ba5 Mon Sep 17 00:00:00 2001 From: ysymi Date: Tue, 3 Apr 2018 23:11:27 +0800 Subject: [PATCH] Optimize the reopen_files by using FileHandler's method: close & _open --- gunicorn/glogging.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index e876aac8..f6793631 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -377,9 +377,8 @@ class Logger(object): handler.acquire() try: if handler.stream: - handler.stream.close() - handler.stream = open(handler.baseFilename, - handler.mode) + handler.close() + handler.stream = handler._open() finally: handler.release()