Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 73 lines 3.0 kB view raw
1From 4880b9c67628a781bdb183dcdc69f12cb829817d Mon Sep 17 00:00:00 2001 2From: Jean Delvare <jdelvare@suse.de> 3Date: Sat, 15 Apr 2023 11:53:27 +0200 4Subject: [PATCH] rtkit-daemon: Don't log debug messages by default 5 6The rtkit-daemon service is a lot more verbose than other services 7when it doesn't have anything to do. Stop logging the debug messages 8by default to avoid flooding the system log. 9 10This addresses issue #22. 11--- 12 rtkit-daemon.c | 13 +++++++++++++ 13 1 file changed, 13 insertions(+) 14 15diff --git a/rtkit-daemon.c b/rtkit-daemon.c 16index 17122fa..0c5d814 100644 17--- a/rtkit-daemon.c 18+++ b/rtkit-daemon.c 19@@ -154,6 +154,9 @@ static bool canary_demote_unknown = FALSE; 20 /* Log to stderr? */ 21 static bool log_stderr = FALSE; 22 23+/* Also log debugging messages? */ 24+static bool log_debug = FALSE; 25+ 26 /* Scheduling policy to use */ 27 static int sched_policy = SCHED_RR; 28 29@@ -1876,6 +1879,7 @@ enum { 30 ARG_CANARY_DEMOTE_UNKNOWN, 31 ARG_CANARY_REFUSE_SEC, 32 ARG_STDERR, 33+ ARG_DEBUG, 34 ARG_INTROSPECT 35 }; 36 37@@ -1905,6 +1909,7 @@ static const struct option long_options[] = { 38 { "canary-demote-unknown", no_argument, 0, ARG_CANARY_DEMOTE_UNKNOWN }, 39 { "canary-refuse-sec", required_argument, 0, ARG_CANARY_REFUSE_SEC }, 40 { "stderr", no_argument, 0, ARG_STDERR }, 41+ { "debug", no_argument, 0, ARG_DEBUG }, 42 { "introspect", no_argument, 0, ARG_INTROSPECT }, 43 { NULL, 0, 0, 0} 44 }; 45@@ -1933,6 +1938,7 @@ static void show_help(const char *exe) { 46 " --version Show version\n\n" 47 "OPTIONS:\n" 48 " --stderr Log to STDERR in addition to syslog\n" 49+ " --debug Also log debugging mssages\n" 50 " --user-name=USER Run daemon as user (%s)\n\n" 51 " --scheduling-policy=(RR|FIFO) Choose scheduling policy (%s)\n" 52 " --our-realtime-priority=[%i..%i] Realtime priority for the daemon (%u)\n" 53@@ -2222,6 +2228,10 @@ static int parse_command_line(int argc, char *argv[], int *ret) { 54 log_stderr = TRUE; 55 break; 56 57+ case ARG_DEBUG: 58+ log_debug = TRUE; 59+ break; 60+ 61 case ARG_INTROSPECT: 62 fputs(introspect_xml, stdout); 63 *ret = 0; 64@@ -2251,6 +2261,9 @@ static int parse_command_line(int argc, char *argv[], int *ret) { 65 return -1; 66 } 67 68+ if (!log_debug) 69+ setlogmask(LOG_UPTO(LOG_INFO)); 70+ 71 assert(our_realtime_priority >= (unsigned) sched_get_priority_min(sched_policy)); 72 assert(our_realtime_priority <= (unsigned) sched_get_priority_max(sched_policy)); 73