[systemd-devel] show journalctl while stopping?

Lennart Poettering lennart at poettering.net
Tue Mar 31 12:56:12 UTC 2020


On Do, 23.01.20 10:32, Roger Pack (rogerdpack2 at gmail.com) wrote:

> Forgive me if this is too naive, but would it be possible for
> systemctl to "immediately start outputting logs" (journalctl type
> output) while it is in the middle of running a command?  Ex: while
> running "systemctl stop my_server" it could show the logs so we could
> see what is going on?  I do miss that from the /etc/init.d days and
> feel so blind with systemctl now.

This has been on the TODO list for a while, but it wasn't trivial to
implement for most of the time, because of races: the log stream we
want to show and the stream of unit state changes are independant of
each other and fully asynchronous hence we never knew if all log
messages via the journal were already processed when we got notified
about the unit being fully down or fully up, i.e. we wouldn't know how
much longer to show logs before being done.

This has mostly been resolved in journald now, there's a way to sync
on the log stream, i.e. we could now issue the start or stop command
to PID 1, and then wait for it complete, and then issue a sync request
to journald that lets us know when all log messages enqueued up to
that point are fully processed, and then exit, so that we wouldn't
miss anything anymore. Now it's just a matter of putting this all
together.

So yes, it's on the TODO list, has always been there, and we are
inching closer to actually delivering it properly.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list