You can't connect() to 'tcp://*:6666', you should be getting an error. You need to specify a host or ip.
-Michel On Mon, Aug 13, 2012 at 7:39 AM, andrea crotti <[email protected]> wrote: > 2012/8/13 andrea crotti <[email protected]>: >> 2012/8/13 Brian Knox <[email protected]>: >>> This might interest you: >>> >>> http://zeromq.github.com/pyzmq/logging.html >> >> Great, exactly what I wanted to implement, thanks! > > > I can't understand how to actually subscribe to the logger though, > this example doesn't quite work.. > If I subscribe to '' it should get all the possible messages right? > > import sys > import zmq > import logging > > from zmq.log.handlers import PUBHandler > PORT = 'tcp://*:6666' > > > if __name__ == '__main__': > if len(sys.argv) > 1: > context = zmq.Context() > sock = context.socket(zmq.PUB) > sock.bind(PORT) > > handler = PUBHandler(sock) > > root = logging.getLogger() > root.addHandler(handler) > > root.debug("topic.subtopic::debug message") > root.info("Info message") > while True: > root.info(raw_input("What do you want to say?")) > > else: > context = zmq.Context() > sock = context.socket(zmq.SUB) > sock.connect(PORT) > sock.setsockopt(zmq.SUBSCRIBE, '') > while True: > msg = sock.recv() > print("got message %s" % msg) > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
