summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bf4dcf7)
raw | patch | inline | side by side (parent: bf4dcf7)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 10 Jan 2017 21:23:55 +0000 (22:23 +0100) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Wed, 22 Feb 2017 17:33:52 +0000 (18:33 +0100) |
This prevents early startup log messages from going unnoticed if the
default logfile isn't writeable.
Fixes: #2057
default logfile isn't writeable.
Fixes: #2057
src/logfile.c | patch | blob | history |
diff --git a/src/logfile.c b/src/logfile.c
index e51c9db9f3a3f50144a7635a29871c6bc638495d..ef3aa97e59b4547fec0aa57992223212bf0071f2 100644 (file)
--- a/src/logfile.c
+++ b/src/logfile.c
#include "common.h"
#include "plugin.h"
-#define DEFAULT_LOGFILE LOCALSTATEDIR "/log/collectd.log"
-
#if COLLECT_DEBUG
static int log_level = LOG_DEBUG;
#else
pthread_mutex_lock(&file_lock);
if (log_file == NULL) {
- fh = fopen(DEFAULT_LOGFILE, "a");
- do_close = 1;
+ fh = stderr;
} else if (strcasecmp(log_file, "stderr") == 0)
fh = stderr;
else if (strcasecmp(log_file, "stdout") == 0)
if (fh == NULL) {
char errbuf[1024];
- fprintf(stderr, "logfile plugin: fopen (%s) failed: %s\n",
- (log_file == NULL) ? DEFAULT_LOGFILE : log_file,
+ fprintf(stderr, "logfile plugin: fopen (%s) failed: %s\n", log_file,
sstrerror(errno, errbuf, sizeof(errbuf)));
} else {
if (print_timestamp)