[zeromq-dev] czmq 2.2->3.0 - how to handle a fd with a zloop_reader?

Michael Haberler mail17 at mah.priv.at
Tue May 19 18:15:36 CEST 2015


> Am 19.05.2015 um 10:56 schrieb Pieter Hintjens <ph at imatix.com>:
> 
> Yes, see zsys_set_logsender. You connect your custom log handler as a
> SUB to the zsys PUB logging system.

I thought I'll use our existing log daemon and have it listen on an IPC SUB socket, that works fine - I can inject messages with pyzmq script and those get logged:

  socket = context.socket(zmq.PUB)
  socket.bind("ipc:///tmp/0.logsub.a42c8c6b-4025-4f83-ba28-dad21114744a")
  socket.send_multipart(["tag", "log message shows up just fine"])
  

the odd thing is - log entries sent from some other process using the czmq "zsys PUB logging system" do not get logged, relevant code is:

    zsys_handler_set(NULL);   // needed for signalfd handling of signals, not sure if its relevant
    ....
    zsys_set_logsystem (false);
    zsys_set_logident ("haltalk");	
    zsys_set_logsender("ipc:///tmp/0.logsub.a42c8c6b-4025-4f83-ba28-dad21114744a");

    zsys_notice ("----- this doesnt get logged execept on stdout ----- ");

I dont see any tangible difference from https://github.com/zeromq/czmq/blob/v3.0.0/src/zsys.c#L1551-L1563 other than ipc vs inproc

Am I missing some assumption?

- Michael




>     
> 
> On Tue, May 19, 2015 at 10:35 AM, Michael Haberler <mail17 at mah.priv.at> wrote:
>> 
>>> Am 19.05.2015 um 09:11 schrieb Pieter Hintjens <ph at imatix.com>:
>>> 
>>> In theory the 3.x API fully supports the 2.x API (though parts of that
>>> were deprecated).
>>> 
>>> This code should work as-is. If it doesn't, we'll investigate.
>> 
>> It does - conversion complete, water level below chin.
>> 
>> Is there a way to redirect czmq logging to a custom log handler (used around here) - I see stdout/stderr options, or syslog, but no custom handler
>> 
>> thanks!
>> 
>> - Michael
>> 
>> 
>> 
>>> 
>>> -Pieter
>>> 
>>> On Tue, May 19, 2015 at 2:14 AM, Michael Haberler <mail17 at mah.priv.at> wrote:
>>>> I have this APIv2.2 fragment:
>>>> 
>>>> zmq_pollitem_t signal_poller = { 0, self->signal_fd, ZMQ_POLLIN };
>>>> zloop_poller(loop, &signal_poller, handle_signal, self);
>>>> 
>>>> Am I correct assuming the fd polling API has not changed from 2->3, and should be left as-is? or is there some zloop_reader stunt instead?
>>>> 
>>>> thanks in advance
>>>> 
>>>> Michael
>>>> _______________________________________________
>>>> zeromq-dev mailing list
>>>> zeromq-dev at lists.zeromq.org
>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> 
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list