[zeromq-dev] Logging format for sys://log transport
Oliver Smith
oliver at kfs.org
Wed Nov 17 17:58:11 CET 2010
I would like to pose a question here: who is the target audience the
sys://log transport?
"syslog" is primarily intended for system administrators. But it seems
like sys://log is more of a debug trail for programmers.
Among many excellent designs by my predecessor here was our product's
logging system "dbugLog" which, although a little verbose, has
continually proven invaluable for diagnosing complex interactions across
a series of distributed processes.
The format is:
LEVEL [TIMESTAMP SOURCEFILE:LINENO] MESSAGE
The []s are literals, there to help with stripping that information out
with awk/perl/etc.
E.g.
I [20101116-12:21:13.399.221 zmqSend.cpp:112] Connection opened
We have a normalized convention of beginning "message" with a set of
key:value pairs that distinguish attributions such as ... which
"teulIndex" (our internal socket API), which user, etc.
I [20101116-12:21:13.399.221 login.cpp:875] t:2231 p:10502 c:oliver
login granted
I've now started using zmq to log these messages and altered the format
a little,
LEVEL|FACILITY|TIMESTAMP|SOURCE:LINE|ATTRIBUTIONS|MESSAGE|[BACKTRACE]
I've worked with a lot of distributed systems in the last ~20 years, but
it has been a wonderful experience being able to rely so heavily on the
logs.
The inclusion of __FILENAME__ __LINENO__ in the logs has the convenience
of tying in nicely with various IDEs which can be coaxed into receiving
a quick rework of the logs into an errors list and give you a guided
tour of the program flow... Mmm...
This may be more complex than ZMQ needs, but I wanted to put it out
there as food for thought.
- Oliver
More information about the zeromq-dev
mailing list