前景提要
HDC调试需求开发(15万预算),能者速来!>>>
@难易 你好,想跟你请教个问题:
项目中使用到了你的zlog 1.2.12版本(目前最新版本了吧),我们的项目使用是线程池并发处理, 测试的时候偶尔会出现core dump的情况,core dump原因主要是使用了dzlog函数打印了十六进制,不知道与这个有没有关系,跟踪core文件如下:
#0 0x00007f6db3cef9c1 in vfprintf () from /lib64/libc.so.6 #1 0x00007f6db3d1a079 in vsnprintf () from /lib64/libc.so.6 #2 0x00007f6db6a775c9 in zlog_buf_vprintf (a_buf=a_buf@entry=0x7f6cfc017cc0, format=0x7f6d8b357e20 "-", ' ' <repeats 13 times>, "\312\375\276\335\303\334\316\304 = [\314.\223\321\300\070/$!%n\333\324&\235\270O)40\273TgGxX\f~\353j.\233s7z*\\\321c)\004\v\323\215\275O\222\270\316\066\330\332\253\272\067\070\026z\332\031\312\362\331\243;\241\324,]\263\230\177/\272\065\234H]\233\374\327\372\205\220\377\224X\214\350\066D\340\370Jw\230\240\371\031\261\364w\261G\201\321\242r\350\026f\236\t\t\177\220\301\025\362\232_\265][pack.c:1678]", args=0x7f6cfc0109a8) at buf.c:220 #3 0x00007f6db6a7f2f1 in zlog_spec_write_usrmsg (a_spec=<optimized out>, a_thread=0x7f6cfc008aa0, a_buf=0x7f6cfc017cc0) at spec.c:249 #4 0x00007f6db6a7a8be in zlog_format_gen_msg (a_format=0x169ad20, a_thread=a_thread@entry=0x7f6cfc008aa0) at format.c:156 #5 0x00007f6db6a7d88b in zlog_rule_output_dynamic_file_rotate (a_rule=0x16d7ee0, a_thread=0x7f6cfc008aa0) at rule.c:294 #6 0x00007f6db6a78865 in zlog_category_output (a_category=0x16e9ce0, a_thread=a_thread@entry=0x7f6cfc008aa0) at category.c:229 #7 0x00007f6db6a84078 in dzlog (file=0x7f6db5fa0e8a "liblog.c", filelen=8, func=0x7f6db5fa0e93 <__FUNCTION__.7907> "logDebug", funclen=8, line=82, level=20, format=0x7f6d8b357e20 "-", ' ' <repeats 13 times>, "\312\375\276\335\303\334\316\304 = [\314.\223\321\300\070/$!%n\333\324&\235\270O)40\273TgGxX\f~\353j.\233s7z*\\\321c)\004\v\323\215\275O\222\270\316\066\330\332\253\272\067\070\026z\332\031\312\362\331\243;\241\324,]\263\230\177/\272\065\234H]\233\374\327\372\205\220\377\224X\214\350\066D\340\370Jw\230\240\371\031\261\364w\261G\201\321\242r\350\026f\236\t\t\177\220\301\025\362\232_\265][pack.c:1678]") at zlog.c:906 #8 0x00007f6db5fa0cf7 in logDebug (loglevel=13, frm=0x7f6db4ad3007 "%20s = [%s][%s:%d]") at liblog.c:82 #9 0x00007f6db4ad218b in _Pack_E4 (sMsg=0x7f6d8b35d900 "000122", uMsgLen=0x7f6d8b38dd44, sMsg=0x7f6d8b35cf60) at pack.c:1678 #10 0x00007f6db5762f5f in _Flow (sInMsg=0x7f6d7805b098 "070026ABCDEFGHIJKLMNOPQRSTUVWXYZ;K00400", uInLen=39, sOutMsg=0x7f6d8b37dd50 "", uOutLen=0x7f6d8b38dd44) at work_flow.c:723 #11 0x00007f6db5327ddf in _Flow_Read (set=0x606400 <s_set>, len=1, s=0x7f6d78053470, iFlag=0) at main_flow.c:251 #12 0x00007f6db53285a0 in _Main_Flow_Read (arg=0x16fa7a8) at main_flow.c:421 #13 0x00007f6db61a48b7 in thread_routine (arg=0x0) at threadpool.c:213 #14 0x00007f6db6e9adf5 in start_thread () from /lib64/libpthread.so.0 #15 0x00007f6db3d9b1ad in clone () from /lib64/libc.so.6
另外压力测试时还会出现日志写到配置文件的情况(写入时无规则,可能会在配置文件中间被写入),我看到《zlog用户手册》也有提到这个问题,但是由于目前项目测试原因,守护进程并未关闭系统默认的输入输出fd,也并未使用到《zlog用户手册》提到的情况,不知是否还有其他问题会引起该问题呢?
zlog的确是个不错的日志程序,虽然程序不怎么能看懂,也没有时间好好研究一下。
最后,非常感谢!