def _open(self): now = datetime.datetime.now() log_today = "%s.%s" % (self._filename, now.strftime('%Y-%m-%d')) try: # create the log file atomically fd = os.open( log_today, os.O_CREAT | os.O_EXCL, stat.S_IWUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) # if coming here, the log file was created successfully os.close(fd) except OSError as e: if e.errno != errno.EEXIST: # should not happen raise self.baseFilename = log_today self._makeSymLink(log_today) return FileHandler._open(self)
def _open(self): # We import settings here to avoid a circular reference as this module # will be imported when settings.py is executed. from django.conf import settings self.baseFilename = os.path.join(settings.LOG_ROOT, self.filename) return BaseFileHandler._open(self)
def _open(self): if self._filename_set: #from os from path import self.baseFilename = join_path(log_cfg['LOG_ROOT'], self.filename) return BaseFileHandler._open(self)