git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] daemon: add --no-syslog to undo implicit --syslog
@ 2018-01-22 23:23 Lucas Werkmeister
  2018-01-23  0:00 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 21+ messages in thread
From: Lucas Werkmeister @ 2018-01-22 23:23 UTC (permalink / raw)
  To: git; +Cc: Lucas Werkmeister

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


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

end of thread, other threads:[~2018-02-05 20:09 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 23:23 [PATCH] daemon: add --no-syslog to undo implicit --syslog Lucas Werkmeister
2018-01-23  0:00 ` Ævar Arnfjörð Bjarmason
2018-01-23 18:30   ` Junio C Hamano
2018-01-23 22:06     ` Lucas Werkmeister
2018-01-24 10:05       ` Lucas Werkmeister
2018-01-24 18:33       ` Junio C Hamano
2018-01-24 19:48         ` Lucas Werkmeister
2018-01-27 18:31         ` [PATCH v2] daemon: add --send-log-to=(stderr|syslog|none) Lucas Werkmeister
2018-01-28  6:40           ` Eric Sunshine
2018-01-28 22:58             ` Lucas Werkmeister
2018-01-29  0:10               ` Eric Sunshine
2018-02-03 23:08                 ` [PATCH v3] daemon: add --log-destination=(stderr|syslog|none) Lucas Werkmeister
2018-02-04  6:36                   ` Eric Sunshine
2018-02-04 18:29                     ` Lucas Werkmeister
2018-02-04 18:30                       ` [PATCH v4] " Lucas Werkmeister
2018-02-04 18:55                         ` Ævar Arnfjörð Bjarmason
2018-02-04 18:58                           ` Lucas Werkmeister
2018-02-05 20:09                             ` Ævar Arnfjörð Bjarmason
2018-02-04 19:44                           ` Eric Sunshine
2018-02-04 19:36                         ` Eric Sunshine
2018-02-05 18:31                           ` Junio C Hamano

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

	https://80x24.org/mirrors/git.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).