【问题标题】:need systemd error loging document需要 systemd 错误记录文档
【发布时间】:2013-11-05 17:42:07
【问题描述】:

由于 syslog 错误日志记录在某些 Linux 发行版(如 arch Linux)中已过期,我正在寻找某种方法来记录 systemd 错误,但我找不到任何有关它的文档或资源。如果您知道使用 systemd 进行错误记录,请帮助我。

【问题讨论】:

  • Google 是个不错的地方。尝试类似 替换 systemd 错误日志新版本的 Linux

标签: c logging syslog rsyslog systemd


【解决方案1】:

如果您需要从应用程序中记录某些内容,只需以如下方式打印到 stderr:

#include <systemd/sd-daemon.h>

// some code here

fprintf(stderr, SD_ERR "Some error meassge from the app");

// some code there

如果你想在命令提示符下输入消息类型:

$ systemd-journalctl

请参阅thisthatthat

【讨论】:

    猜你喜欢
    • 2020-11-13
    • 2020-03-23
    • 2021-01-13
    • 2022-11-16
    • 1970-01-01
    • 2018-08-12
    • 2012-09-14
    • 2014-02-16
    • 1970-01-01
    相关资源
    最近更新 更多