def daemon_main(self): if config.logreqs: self.logfile_access = logfile.DailyLogFile.fromFullPath(os.path.join(config.datadir, 'logs', 'access.log')) else: self.logfile_access = log.NullFile() if config.debugmode: if config.debugtostdout and config.nodaemon: self.logfile_debug = sys.stdout else: self.logfile_debug = logfile.DailyLogFile.fromFullPath(os.path.join(config.datadir, 'logs', 'debug.log')) else: self.logfile_debug = log.NullFile() log.startLogging(self.logfile_debug) reactor.listenTCPonExistingFD = listenTCPonExistingFD reactor.listenUNIX(os.path.join(config.rundir, 'rpc.socket'), factory=pb.PBServerFactory(self.rpc_server)) for i in range(config.processes): subprocess = spawnT2W(self, self.childFDs, self.fds_https, self.fds_http) self.subprocesses.append(subprocess.pid) def MailException(etype, value, tb): sendexceptionmail(config, etype, value, tb) sys.excepthook = MailException reactor.run()
def verify_missing(zmq_endpoint): """Check that all messages go through AMQP and ZeroMQ.""" if tw_log is None: raise click.exceptions.UsageError( "You need to install Twisted to use this command." ) # When the current RHEL has Twisted 15+, we can use twisted.logger # tw_logger.globalLogPublisher.addObserver( # tw_logger.STDLibLogObserver(name="verify_missing") # ) # Send all the logs to stdlib's logging library tw_log.PythonLoggingObserver(loggerName="verify_missing").start() tw_log.startLogging(tw_log.NullFile()) zmq_endpoints = zmq_endpoint or config.conf["zmq_to_amqp"]["zmq_endpoints"] if not zmq_endpoints: raise click.exceptions.UsageError( "No ZeroMQ endpoints defined, please provide one or more endpoints " "using the --zmq-endpoint flag or by setting endpoints in the " '"zmq_to_amqp" section of your configuration.' ) try: verify_missing_module.main(zmq_endpoints) except zmq.error.ZMQError as e: _log.exception(e) except Exception: _log.exception("An unexpected error occurred, please file a bug report")
def __init__(self, v): log.FileLogObserver.__init__(self, log.NullFile()) self.modules = {} self.v = v
from kademlia.protocol import KademliaProtocol from kademlia.crawling import NodeSpiderCrawl, ValueSpiderCrawl, RPCFindResponse from kademlia.utils import digest from kademlia.storage import ForgetfulStorage from kademlia.node import Node from kademlia import version as kademlia_version from collections import Counter from twisted.python import log from calvin.utilities import calvinlogger import base64 _log = calvinlogger.get_logger(__name__) # Make twisted (rpcudp) logs go to null log.startLogging(log.NullFile(), setStdout=0) # Fix for None types in storage class ForgetfulStorageFix(ForgetfulStorage): def get(self, key, default=None): self.cull() if key in self.data: return (True, self[key]) return (False, default) class KademliaProtocolAppend(KademliaProtocol): def __init__(self, *args, **kwargs): self.set_keys = kwargs.pop('set_keys', set([])) KademliaProtocol.__init__(self, *args, **kwargs)
def _openLogFile(self, path): return log.NullFile()