Skip to main content
Might need to flush.
Source Link
Stephen Kitt
  • 482.8k
  • 60
  • 1.2k
  • 1.4k

When run using systemd, a unit’s standard output goes to whatever the unit’s StandardOutput= configuration setting specifies. That defaults to the system configuration’s DefaultStandardOutput= value, and that defaults to journal. So if your system uses default settings, units’ standard output should go to the journal.

For any given unit, you can check that setting by running

systemctl show -P StandardOutput yourunit 

(replacing yourunit as appropriate).

One thing to check is whether your program is flushing its output: with printf, you need to include a newline (\n) or explicitly call fflush.

As a general rule, log messages should be written using syslog, not sent to standard output; see Proper way to write C code that injects message into /var/log/messages? for details.

When run using systemd, a unit’s standard output goes to whatever the unit’s StandardOutput= configuration setting specifies. That defaults to the system configuration’s DefaultStandardOutput= value, and that defaults to journal. So if your system uses default settings, units’ standard output should go to the journal.

For any given unit, you can check that setting by running

systemctl show -P StandardOutput yourunit 

(replacing yourunit as appropriate).

As a general rule, log messages should be written using syslog, not sent to standard output; see Proper way to write C code that injects message into /var/log/messages? for details.

When run using systemd, a unit’s standard output goes to whatever the unit’s StandardOutput= configuration setting specifies. That defaults to the system configuration’s DefaultStandardOutput= value, and that defaults to journal. So if your system uses default settings, units’ standard output should go to the journal.

For any given unit, you can check that setting by running

systemctl show -P StandardOutput yourunit 

(replacing yourunit as appropriate).

One thing to check is whether your program is flushing its output: with printf, you need to include a newline (\n) or explicitly call fflush.

As a general rule, log messages should be written using syslog, not sent to standard output; see Proper way to write C code that injects message into /var/log/messages? for details.

Source Link
Stephen Kitt
  • 482.8k
  • 60
  • 1.2k
  • 1.4k

When run using systemd, a unit’s standard output goes to whatever the unit’s StandardOutput= configuration setting specifies. That defaults to the system configuration’s DefaultStandardOutput= value, and that defaults to journal. So if your system uses default settings, units’ standard output should go to the journal.

For any given unit, you can check that setting by running

systemctl show -P StandardOutput yourunit 

(replacing yourunit as appropriate).

As a general rule, log messages should be written using syslog, not sent to standard output; see Proper way to write C code that injects message into /var/log/messages? for details.