all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: guix-devel <guix-devel@gnu.org>
Subject: Shepherd service logging
Date: Mon, 04 Dec 2023 23:50:27 +0100	[thread overview]
Message-ID: <878r69lgzw.fsf@inria.fr> (raw)

Hello Guix!

The ‘wip-logging’ branch of the Shepherd contains changes that allow
clients such ‘herd status’ to display recently-logged messages, like
this:

--8<---------------cut here---------------start------------->8---
$ ./herd -s sock status test-logging
Status of test-logging:
  It is running since 22:41:51 (7 seconds ago).
  Running value is 31389.
  It is enabled.
  Provides (test-logging).
  Requires ().
  Will be respawned.

Recent messages:
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
--8<---------------cut here---------------end--------------->8---

Another *cough* popular service manager provides a facility that looks
like this and I find it convenient.

Internally, shepherd maintains a ring buffer of the last lines printed
by each service.  To do that, the first step was to establish a
connection between the “logger” and the service it’s associated with—so
far, the logging mechanism was started by ‘fork+exec-command’, which
doesn’t know what service it’s working for.  Loggers are now actors that
services can query to get those last messages.

The changes so far look like this:

  627ad75 herd: ‘status’ displays recently-logged messages.
  0b44232 service: Communicate recently-logged messages to clients.
  823beae service: Associate loggers with services; keep buffer of logged lines.
  cc8ea8a service: Built-in logger logs the PID of the service.
  088997a service: Thread the current service to actions.
  3302861 service: Move line-by-line log reading to a separate fiber.

Thoughts?

I suppose that’s maybe more for the next stable series (1.0!) than for
0.10.x.

Cheers,
Ludo’.


             reply	other threads:[~2023-12-04 22:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 22:50 Ludovic Courtès [this message]
2023-12-04 23:35 ` Shepherd service logging Felix Lechner via Development of GNU Guix and the GNU System distribution.
2023-12-05 15:39   ` Attila Lendvai
2024-04-18  9:43     ` No public interface for shepherd-package (Was: Shepherd service logging) Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-04-19 20:14       ` No public interface for shepherd-package Ludovic Courtès
2024-04-21 16:13         ` Felix Lechner via Development of GNU Guix and the GNU System distribution.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878r69lgzw.fsf@inria.fr \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.