【发布时间】:2018-12-05 10:35:31
【问题描述】:
我安装了 metalog 我的服务器并使用 C++ 应用程序来编写日志。 这是我打印到系统日志的方式
openlog(facility.c_str(), LOG_CONS | LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_LOCAL0);
syslog(LOG_INFO, "%s", stderr_msg.c_str());
我所有的日志都以以下格式打印:
<date> [kernel] <log text message>
例如
Dec 05 12:19:31 [kernel] this is an example of log
我想改变它而不是[内核],它会打印相关模块。 或者至少是我的应用程序名称,但不是“内核”。 我该怎么做?
【问题讨论】:
标签: c++ linux-kernel syslog