X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Flogfile.c;h=eca8c34758363507872f33ec13b075019c3575a0;hp=0de639e966704200232514ede2f8ea277059fad8;hb=fb0cc621d4357bbe4a9dc36c7f055f46257ce57c;hpb=c44f866db154793ce706a17ec815ffa642314414 diff --git a/src/logfile.c b/src/logfile.c index 0de639e9..eca8c347 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -31,8 +31,6 @@ #include "common.h" #include "plugin.h" -#define DEFAULT_LOGFILE LOCALSTATEDIR "/log/collectd.log" - #if COLLECT_DEBUG static int log_level = LOG_DEBUG; #else @@ -117,8 +115,7 @@ static void logfile_print(const char *msg, int severity, 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) @@ -130,8 +127,7 @@ static void logfile_print(const char *msg, int severity, 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)