git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] daemon: add --no-syslog to undo implicit --syslog

From
Lucas Werkmeister <mail@lucaswerkmeister.de>
Date
Jan 22, 2018, 23:23 UTC
Message-ID
<20180122232304.4863-1-mail@lucaswerkmeister.de>

Several options imply --syslog, without there being a way to disable it again. This commit adds that option.

This is useful, for instance, when running `git daemon` as a systemd service with --inetd. systemd connects stderr to the journal by default, so logging to stderr is useful. On the other hand, log messages sent via syslog also reach the journal eventually, but run the risk of being processed at a time when the `git daemon` process has already exited (especially if the process was very short-lived, e.g. due to client error), so that the journal can no longer read its cgroup and attach the message to the correct systemd unit. See systemd/systemd#2913 [1].

[1]: https://github.com/systemd/systemd/issues/2913
Signed-off-by: Lucas Werkmeister <mail@lucaswerkmeister.de>
---
Notes:
    I decided not to add the option to git-daemon's --help output, since
    the similar --no-informative-errors option is also not listed there.
    Let me know if it should be added.
    
    Feel free to remove the part about systemd from the commit message
    if you feel it doesn't need to be included.
 Documentation/git-daemon.txt | 6 ++++--
 daemon.c                     | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index 3c91db7be..dfd6ce03c 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -8,7 +8,7 @@ git-daemon - A really simple server for Git repositories
 SYNOPSIS
 --------
 [verse]
-'git daemon' [--verbose] [--syslog] [--export-all]
+'git daemon' [--verbose] [--[no-]syslog] [--export-all]
 	     [--timeout=<n>] [--init-timeout=<n>] [--max-connections=<n>]
 	     [--strict-paths] [--base-path=<path>] [--base-path-relaxed]
 	     [--user-path | --user-path=<path>]
@@ -109,9 +109,11 @@ OPTIONS
 	Maximum number of concurrent clients, defaults to 32.  Set it to
 	zero for no limit.
 
---syslog::
+--[no-]syslog::
 	Log to syslog instead of stderr. Note that this option does not imply
 	--verbose, thus by default only error conditions will be logged.
+	`--no-syslog` is the default, but may be given explicitly to override
+	the implicit `--syslog` of an earlier `--inetd` or `--detach` option.
 
 --user-path::
 --user-path=<path>::
diff --git a/daemon.c b/daemon.c
index e37e343d0..d59fef6d6 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1300,6 +1300,10 @@ int cmd_main(int argc, const char **argv)
 			log_syslog = 1;
 			continue;
 		}
+		if (!strcmp(arg, "--no-syslog")) {
+			log_syslog = 0;
+			continue;
+		}
 		if (!strcmp(arg, "--export-all")) {
 			export_all_trees = 1;
 			continue;
-- 
2.16.0
Next: Ævar Arnfjörð Bjarmason
Message 1 of 21 in “daemon: add --no-syslog to undo implicit --syslog”
  1. daemon: add --no-syslog to undo implicit --syslogLucas Werkmeister, Jan 22, 2018
  2. Ævar Arnfjörð BjarmasonJan 23, 2018
  3. Junio C HamanoJan 23, 2018
  4. Lucas WerkmeisterJan 23, 2018
  5. Lucas WerkmeisterJan 24, 2018
  6. Junio C HamanoJan 24, 2018
  7. Lucas WerkmeisterJan 24, 2018
  8. daemon: add --send-log-to=(stderr|syslog|none)Lucas Werkmeister, Jan 27, 2018
  9. Eric SunshineJan 28, 2018
  10. Lucas WerkmeisterJan 28, 2018
  11. Eric SunshineJan 29, 2018
  12. daemon: add --log-destination=(stderr|syslog|none)Lucas Werkmeister, Feb 3, 2018
  13. Eric SunshineFeb 4, 2018
  14. Lucas WerkmeisterFeb 4, 2018
  15. daemon: add --log-destination=(stderr|syslog|none)Lucas Werkmeister, Feb 4, 2018
  16. Ævar Arnfjörð BjarmasonFeb 4, 2018
  17. Lucas WerkmeisterFeb 4, 2018
  18. Ævar Arnfjörð BjarmasonFeb 5, 2018
  19. Eric SunshineFeb 4, 2018
  20. Eric SunshineFeb 4, 2018
  21. Junio C HamanoFeb 5, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.