Code

Set urgency to high.
[pkg-collectd.git] / debian / patches / bts770694_loglevel.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## bts770694_loglevel.dpatch
3 ##
4 ## DP: Make sure not to disable logging on invalid log levels.
5 ## DP:
6 ## DP: Debug logging is not compiled into the Debian packages. Make sure to
7 ## DP: fall back to INFO and report and error rather than silently dropping
8 ## DP: all further log messages.
9 ## DP:
10 ## DP: Upstream bug report:
11 ## DP: https://github.com/collectd/collectd/issues/636
12 ## DP:
13 ## DP: Upstream commits:
14 ## DP: https://github.com/dothebart/collectd/commit/84c3805
15 ## DP: https://github.com/collectd/collectd/commit/cb4ea71
17 @DPATCH@
19 diff a/src/logfile.c b/src/logfile.c
20 --- a/src/logfile.c
21 +++ b/src/logfile.c
22 @@ -54,7 +54,11 @@ static int logfile_config (const char *key, const char *value)
23  {
24         if (0 == strcasecmp (key, "LogLevel")) {
25                 log_level = parse_log_severity(value);
26 -               if (log_level == -1) return 1; /* to keep previous behaviour */
27 +               if (log_level < 0) {
28 +                       log_level = LOG_INFO;
29 +                       ERROR ("logfile: invalid loglevel [%s] defaulting to 'info'", value);
30 +                       return (1);
31 +               }
32         }
33         else if (0 == strcasecmp (key, "File")) {
34                 sfree (log_file);
35 diff a/src/syslog.c b/src/syslog.c
36 --- a/src/syslog.c
37 +++ b/src/syslog.c
38 @@ -48,7 +48,11 @@ static int sl_config (const char *key, const char *value)
39         {
40                 log_level = parse_log_severity (value);
41                 if (log_level < 0)
42 +               {
43 +                       log_level = LOG_INFO;
44 +                       ERROR ("syslog: invalid loglevel [%s] defaulting to 'info'", value);
45                         return (1);
46 +               }
47         }
48         else if (strcasecmp (key, "NotifyLevel") == 0)
49         {