[systemd-devel] Need help with getting messages into /var/log/messages

Paul Richards paulrichards321 at gmail.com
Wed Aug 1 20:57:32 PDT 2012


Hello,

I have written a program in c that logs using the following:

#include <syslog.h>

void logprintf(const char * format, ...) {
/* some other code here */
vsyslog(LOG_USER | LOG_NOTICE, format, ap);
/* some more code here about va_end, and other nonsense like defining
variables with the value 0xB16B00B5 etc. etc. */
}

-------
Here' the service file:

[Unit]
Description=Fixes scroll wheel issues with certain Wireless Microsoft
mice in X.org

[Service]
ExecStart=/usr/local/sbin/resetmsmice

[Install]
WantedBy=graphical.target
---------

A few questions:

1. My program just runs once on startup and then exits. Do I need to
put anything in the service file for that?
2. My main question: The logging isn't making it into
/var/log/messages or into dmesg. I can only see it with journalctl. Is
there anywhere to fix that? My target system is Fedora 17 vanilla that
runs rsyslog.
3. My program can fork on startup if its necessary to. Should I run it
like that so that it returns immediately? Or just leave it run
regularly. Since it uses usb communications it takes about half a
second to quit out of the interrupt loop so maybe I should set the
fork flag in the service file and have it run that way or is it better
to just run regularly from systemd?
4. I am making rpms for this program as well, should I have the
service files go into '/etc/systemd/system' or in
'/lib/systemd/system'?

Thanks for any help!!!

Paul Richards


More information about the systemd-devel mailing list