def release(self): """ Release file and thread locks. If in 'degraded' mode, close the stream to reduce contention until the log files can be rotated. """ self._console_log("In release", stack=True) try: if self._rotateFailed: self._close() except Exception: self.handleError(NullLogRecord()) finally: try: self._stream_lock_count -= 1 if self._stream_lock_count < 0: self._stream_lock_count = 0 if self._stream_lock_count == 0: self._do_file_unlock() self._console_log("#completed release", stack=False) elif self._stream_lock_count: self._console_log("#inner release (%s)" % (self._stream_lock_count, ), stack=True) except Exception: self.handleError(NullLogRecord()) finally: Handler.release(self)
def release(self): try: self.stream.flush() finally: try: unlock(self.stream_lock) finally: # release thread lock Handler.release(self)
def release(self): """ Release file and thread locks. Flush stream and take care of closing stream in 'degraded' mode. """ try: self.stream.flush() if self._rotateFailed: self.stream.close() finally: # release thread lock Handler.release(self)
def release(self): """ Release file and thread locks. If in 'degraded' mode, close the stream to reduce contention until the log files can be rotated. """ try: if self.stream_lock and not self.stream_lock.closed: unlock(self.stream_lock) except Exception: self.handleError(NullLogRecord()) finally: # release thread lock Handler.release(self)
def release(self): try: self.stream.flush() if self._rotateFailed: self.stream.close() except Exception: # suppress annoyed exception pass finally: try: unlock(self.stream_lock) finally: # release thread lock Handler.release(self)
def release(self): try: if self._exception: self._close() except Exception: self.handleError(NullLogRecord()) finally: try: if self.stream_lock and not self.stream_lock.closed(): self.stream_lock.release() except Exception: self.handleError(NullLogRecord()) finally: Handler.release(self)
def release(self): """ Release file and thread locks. If in 'degraded' mode, close the stream to reduce contention until the log files can be rotated. """ try: if self._rotateFailed: self._close() except Exception: self.handleError(NullLogRecord()) finally: try: if self.stream_lock and not self.stream_lock.closed: unlock(self.stream_lock) except Exception: self.handleError(NullLogRecord()) finally: # release thread lock Handler.release(self)
def release(self): """ Release file and thread locks. Flush stream and take care of closing stream in 'degraded' mode. """ try: if not self.stream.closed: self.stream.flush() if self._rotateFailed: self.stream.close() except IOError: if self._rotateFailed: self.stream.close() finally: try: unlock(self.stream_lock) finally: # release thread lock Handler.release(self)
def release(self): """ 释放文件和handler线程锁,如果获得文件锁失败,则关闭文件避免冲突。 :return : None """ try: if self._rotateFailed: self._close() except Exception: self.handleError(NullLogRecord()) finally: try: if self.stream_lock and not self.stream_lock.closed: self._unlock(self.stream_lock) except Exception: self.handleError(NullLogRecord()) finally: Handler.release(self)
def release(self): """ Release file and thread locks. Flush stream and take care of closing stream in 'degraded' mode. """ try: try: if self.stream: self.stream.flush() except ValueError: #PiCloud: flush sometimes if port disconnected - we'll try to open again self._degrade(True, 'flush failed') if self._rotateFailed and self.stream: self.stream.close() finally: try: unlock(self.stream_lock) except ValueError: if self._rotateFailed: #something is broken (exiting?) self._disable() else: raise finally: # release thread lock Handler.release(self)
def release(self): if not self.stream.closed: self.stream.flush() if not self.stream_lock.closed: fcntl.flock(self.stream_lock, fcntl.LOCK_UN) Handler.release(self)