def acquire(self): """ Acquire thread and file locks. Copid from ConcurrentRotatingFileHandler """ # handle thread lock BaseRotatingHandler.acquire(self) # Issue a file lock. (This is inefficient for multiple active threads # within a single process. But if you're worried about high-performance, # you probably aren't using this log handler.) if self.stream_lock: # If stream_lock=None, then assume close() was called or something # else weird and ignore all file-level locks. if self.stream_lock.closed: # Daemonization can close all open file descriptors, see # https://bugzilla.redhat.com/show_bug.cgi?id=952929 # Try opening the lock file again. Should we warn() here?!? try: self._openLockFile() except Exception: # Don't try to open the stream lock again self.stream_lock = None return lock(self.stream_lock, LOCK_EX)