summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 75f7b4c)
raw | patch | inline | side by side (parent: 75f7b4c)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 17 Nov 2007 19:50:00 +0000 (20:50 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Sat, 24 Nov 2007 11:51:28 +0000 (12:51 +0100) |
Imho STDOUT is only a useful default during debugging (which should be by far
the less common case ;-). In any other case it might just "pollute" the
messages printed by e.g. the init script.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
the less common case ;-). In any other case it might just "pollute" the
messages printed by e.g. the init script.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/logfile.c | patch | blob | history |
diff --git a/src/logfile.c b/src/logfile.c
index 03c2f9233c0d4ac9b5e23a4f157bf2214e464555..f4661245efbaa011a9ff4f4f227f2b69b34c45d5 100644 (file)
--- a/src/logfile.c
+++ b/src/logfile.c
#include <pthread.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) || (strcasecmp (log_file, "stderr") == 0))
+ if (log_file == NULL)
+ {
+ fh = fopen (DEFAULT_LOGFILE, "a");
+ do_close = 1;
+ }
+ else if (strcasecmp (log_file, "stderr") == 0)
fh = stderr;
else if (strcasecmp (log_file, "stdout") == 0)
fh = stdout;
{
char errbuf[1024];
fprintf (stderr, "logfile plugin: fopen (%s) failed: %s\n",
- (log_file == NULL) ? "<null>" : log_file,
+ (log_file == NULL) ? DEFAULT_LOGFILE : log_file,
sstrerror (errno, errbuf, sizeof (errbuf)));
}
else