[zeromq-dev] Logging format for sys://log transport

gonzalo diethelm gdiethelm at dcv.cl
Wed Nov 24 15:13:00 CET 2010


> I think you've misunderstood. The logging system is not meant to be
used
> for debugging 0MQ source code. Instead it is meant for debugging the
> topology.
> 
> Some possible examples of log messages:
> 
> - particular endpoint uses invalid wire-level protocol
> - particular endpoint is not accessible for a prolonged period of time
> - there's a cycle in the topology
> - etc.

I am an ignoramus.

I believe there should never be any (console) output coming from a
library. Therefore, I think the logging facility should be used any time
0MQ feels the urge to communicate something (other than an assert),
including debugging 0MQ.


> I've now started using zmq to log these messages and altered the
format
> a little,
> 
> LEVEL|FACILITY|TIMESTAMP|SOURCE:LINE|ATTRIBUTIONS|MESSAGE|[BACKTRACE]

My experience is similar to Oliver's, and I think logging is a great way
to debug and diagnose (even better, in my opinion, than a real
debugger). For a long time I have relied on basic logging (think
printf()) to diagnose and fix problems. Having a standard way of doing
this in 0MQ is, in my opinion, a very powerful idea. And I agree with
Oliver's proposal, which I would slightly modify to the following (these
are all string fields):

LEVEL|FACILITY|DATE|TIME|SOURCE:LINE|ATTRIBUTIONS|KV|MSG|[BACKTRACE]

LEVEL: a number indicating severity, from 0 (mild) to 9 (grave)
FACILITY: a string identifying a family of messages
DATE: a number with format YYYYMMDD
TIME: a number with format HHMMSS.SSSSSS (how many decimals?)
SOURCE:LINE: the usual
ATTRIBUTIONS: I am not sure what Oliver means by this
KV: a set of "key-value pairs": name=Gonzalo:port=27:state=HUNGRY, etc.
MSG: a free format message (without any pipes or whatever the delimiter
is)
BACKTRACE: now, this surely is Oliver's wishful thinking...

Just think what you could do with a file containing lines like these and
grep... Heavenly!

-- 
Gonzalo Diethelm




More information about the zeromq-dev mailing list