void log_setup_generator(void) {
if (invoked_by_systemd()) {
/* Disable talking to syslog/journal (i.e. the two IPC-based loggers) if we run in system context. */
- if (cg_pid_get_owner_uid(0, NULL) == -ENXIO /* not running in a per-user slice */)
+ if (streq_ptr(getenv("SYSTEMD_SCOPE"), "system"))
log_set_prohibit_ipc(true);
- /* This effectively means: journal for per-user generators, kmsg otherwise */
+ /* This effectively means: journal for per-user service manager generators, kmsg for per-system service manager generators */
log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
} else
log_set_target(LOG_TARGET_AUTO);