unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Shepherd service logging
@ 2023-12-04 22:50 Ludovic Courtès
  2023-12-04 23:35 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2023-12-04 22:50 UTC (permalink / raw)
  To: guix-devel

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’.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-21 16:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-04 22:50 Shepherd service logging Ludovic Courtès
2023-12-04 23:35 ` 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.

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).