[systemd-devel] Antw: [EXT] Re: show journalctl while stopping?

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Tue Mar 31 13:28:46 UTC 2020


>>> Lennart Poettering <lennart at poettering.net> schrieb am 31.03.2020 um 14:56
in
Nachricht
<2402_1585659382_5E833DF6_2402_244_1_20200331125612.GB27547 at gardel-login>:
> 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.

I don't know the internals, but most systems having problems to trace the
state transitions correctly only have "stopped"§ and "started" states, lacking
"stopping" and "starting".
For the log you'd capture everything between "stopped" and "started"
("started" and "stopped", respectively), meaning once the state ist "started",
"starting" has completed. (Similar for a failure). The other direction is
analog.

> 
> 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
> _______________________________________________
> systemd‑devel mailing list
> systemd‑devel at lists.freedesktop.org 
> https://lists.freedesktop.org/mailman/listinfo/systemd‑devel 





More information about the systemd-devel mailing list