Function systemd_journal_logger::connected_to_journal [−][src]
pub fn connected_to_journal() -> bool
Expand description
Whether this process is directly connected to the journal.
Inspects the $JOURNAL_STREAM
environment variable and compares the device and inode
numbers in this variable against the stdout and stderr file descriptors.
Return true
if either stream matches the device and inode numbers in $JOURNAL_STREAM
,
and false
otherwise (or in case of any IO error).
Systemd sets $JOURNAL_STREAM
to the device and inode numbers of the standard output
or standard error streams of the current process if either of these streams is connected
to the systemd journal.
Systemd explicitly recommends that services check this variable to upgrade their logging to the native systemd journal protocol.
See section “Environment Variables Set or Propagated by the Service Manager” in systemd.exec(5) for more information.