Python syslog.closelog() Examples

The following are 17 code examples of syslog.closelog(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module syslog , or try the search function .
Example #1
Source File: core.py    From mitogen with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def _do_broker_main(self):
        """
        Broker thread main function. Dispatches IO events until
        :meth:`shutdown` is called.
        """
        # For Python 2.4, no way to retrieve ident except on thread.
        self._waker.protocol.broker_ident = thread.get_ident()
        try:
            while self._alive:
                self._loop_once()

            fire(self, 'before_shutdown')
            fire(self, 'shutdown')
            self._broker_shutdown()
        except Exception:
            e = sys.exc_info()[1]
            LOG.exception('broker crashed')
            syslog.syslog(syslog.LOG_ERR, 'broker crashed: %s' % (e,))
            syslog.closelog()  # prevent test 'fd leak'.

        self._alive = False  # Ensure _alive is consistent on crash.
        self._exitted = True
        self._broker_exit() 
Example #2
Source File: SipLogger.py    From b2bua with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def run(self):
        self.safe_open()
        while True:
            self.master.wi_available.acquire()
            while len(self.master.wi) == 0:
                self.master.wi_available.wait()
            op, args, kwargs = self.master.wi.pop(0)
            self.master.wi_available.release()
            if op == 'reopen':
                self.safe_open()
                continue
            if op == 'shutdown':
                self.closelog()
                return
            try:
                self.do_write(self.master.format(args, kwargs))
            except:
                # Reopen on any errror, drop message and continue
                self.safe_open() 
Example #3
Source File: SipLogger.py    From rtp_cluster with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def run(self):
        self.safe_open()
        while True:
            self.master.wi_available.acquire()
            while len(self.master.wi) == 0:
                self.master.wi_available.wait()
            op, args, kwargs = self.master.wi.pop(0)
            self.master.wi_available.release()
            if op == 'reopen':
                self.safe_open()
                continue
            if op == 'shutdown':
                self.closelog()
                return
            try:
                self.do_write(self.master.format(args, kwargs))
            except:
                # Reopen on any errror, drop message and continue
                self.safe_open() 
Example #4
Source File: syslog_writer.py    From radish with MIT License 5 votes vote down vote up
def syslog_writer_after_all(self, features):
        import syslog

        syslog.syslog("end run {}".format(self.marker))
        syslog.closelog() 
Example #5
Source File: laikamilter.py    From laikaboss with Apache License 2.0 5 votes vote down vote up
def closeLog(self):
        syslog.closelog() 
Example #6
Source File: __init__.py    From hddfancontrol with GNU General Public License v3.0 5 votes vote down vote up
def close(self):
    """ See logging.Handler.close. """
    syslog.closelog()
    super().close() 
Example #7
Source File: rel12-20-14.py    From runbook with Apache License 2.0 5 votes vote down vote up
def killhandle(signum, frame):
    ''' This will close connections cleanly '''
    line = "SIGTERM detected, shutting down"
    syslog.syslog(syslog.LOG_INFO, line)
    rdb_server.close()
    # zsend.close()  # zsend?
    syslog.closelog()
    sys.exit(0) 
Example #8
Source File: rel7-29-14.py    From runbook with Apache License 2.0 5 votes vote down vote up
def killhandle(signum, frame):
    ''' This will close connections cleanly '''
    line = "SIGTERM detected, shutting down"
    syslog.syslog(syslog.LOG_INFO, line)
    rdb_server.close()
    zsend.close()  # zsend?
    syslog.closelog()
    sys.exit(0) 
Example #9
Source File: rel8-02-14.py    From runbook with Apache License 2.0 5 votes vote down vote up
def killhandle(signum, frame):
    ''' This will close connections cleanly '''
    line = "SIGTERM detected, shutting down"
    syslog.syslog(syslog.LOG_INFO, line)
    rdb_server.close()
    zsend.close()  # zsend?
    syslog.closelog()
    sys.exit(0) 
Example #10
Source File: logger.py    From backintime with GNU General Public License v2.0 5 votes vote down vote up
def closelog():
    syslog.closelog() 
Example #11
Source File: logger.py    From backintime with GNU General Public License v2.0 5 votes vote down vote up
def openlog():
    name = os.getenv('LOGNAME', 'unknown')
    syslog.openlog("%s (%s/1)" %(APP_NAME, name))
    atexit.register(closelog) 
Example #12
Source File: logging.py    From pycopia with Apache License 2.0 5 votes vote down vote up
def close():
    syslog.closelog() 
Example #13
Source File: SipLogger.py    From b2bua with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def closelog(self):
        syslog.closelog() 
Example #14
Source File: SipLogger.py    From b2bua with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def closelog(self):
        del self.log 
Example #15
Source File: gensyslog.py    From genmon with GNU General Public License v2.0 5 votes vote down vote up
def SendNotice(Message):

    try:

        syslog.openlog("genmon")
        syslog.syslog("%s" % Message)
        syslog.closelog()

    except Exception as e1:
        log.error("Error: " + str(e1))
        console.error("Error: " + str(e1))

#------------------- Command-line interface for gengpio ------------------------ 
Example #16
Source File: SipLogger.py    From rtp_cluster with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def closelog(self):
        syslog.closelog() 
Example #17
Source File: SipLogger.py    From rtp_cluster with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def closelog(self):
        del self.log