mardi 3 novembre 2015

Send output to systemd-journal from C++ program

I have some Python programs that I'd like to convert to C++11 code as a way of learning the language. The target platform is Debian, kernel version >=4.2 (i.e. systemd).

In Python I can log debugging/logging information to the system log using the syslog module. In C I would be able to #include <syslog.h>. But, from this article I understand that for the current C++ implementation there is no such implementation (anymore). If the program is a service (or daemon?) this would apparently happen automagically although I don't gather how the message priority would be distinguished.

I've Googled around but can't really find a solution to my problem: How do I send information to the system log from within a C++11 program?

Aucun commentaire:

Enregistrer un commentaire