MCPcopy
hub / github.com/benoitc/gunicorn / reopen_files

Method reopen_files

gunicorn/glogging.py:380–401  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

378 return time.strftime('[%d/%b/%Y:%H:%M:%S %z]')
379
380 def reopen_files(self):
381 if self.cfg.capture_output and self.cfg.errorlog != "-":
382 for stream in sys.stdout, sys.stderr:
383 stream.flush()
384
385 with self.lock:
386 if self.logfile is not None:
387 self.logfile.close()
388 self.logfile = open(self.cfg.errorlog, 'a+')
389 os.dup2(self.logfile.fileno(), sys.stdout.fileno())
390 os.dup2(self.logfile.fileno(), sys.stderr.fileno())
391
392 for log in loggers():
393 for handler in log.handlers:
394 if isinstance(handler, logging.FileHandler):
395 handler.acquire()
396 try:
397 if handler.stream:
398 handler.close()
399 handler.stream = handler._open()
400 finally:
401 handler.release()
402
403 def close_on_exec(self):
404 for log in loggers():

Callers 7

setupMethod · 0.45
handle_usr1Method · 0.45
reloadMethod · 0.45
_signal_handlerMethod · 0.45
_signal_handlerMethod · 0.45
handle_usr1_signalMethod · 0.45
handle_usr1Method · 0.45

Calls 3

loggersFunction · 0.85
closeMethod · 0.45
filenoMethod · 0.45

Tested by

no test coverage detected