projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[2475] write_prometheus plugin: Fix port listening
[collectd.git]
/
src
/
logfile.c
diff --git
a/src/logfile.c
b/src/logfile.c
index
e51c9db
..
6629c0b
100644
(file)
--- a/
src/logfile.c
+++ b/
src/logfile.c
@@
-31,8
+31,6
@@
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
-#define DEFAULT_LOGFILE LOCALSTATEDIR "/log/collectd.log"
-
#if COLLECT_DEBUG
static int log_level = LOG_DEBUG;
#else
#if COLLECT_DEBUG
static int log_level = LOG_DEBUG;
#else
@@
-80,7
+78,6
@@
static void logfile_print(const char *msg, int severity,
cdtime_t timestamp_time) {
FILE *fh;
_Bool do_close = 0;
cdtime_t timestamp_time) {
FILE *fh;
_Bool do_close = 0;
- struct tm timestamp_tm;
char timestamp_str[64];
char level_str[16] = "";
char timestamp_str[64];
char level_str[16] = "";
@@
-107,8
+104,8
@@
static void logfile_print(const char *msg, int severity,
}
if (print_timestamp) {
}
if (print_timestamp) {
-
time_t tt = CDTIME_T_TO_TIME_T(timestamp_time)
;
- localtime_r(&
tt
, ×tamp_tm);
+
struct tm timestamp_tm
;
+ localtime_r(&
CDTIME_T_TO_TIME_T(timestamp_time)
, ×tamp_tm);
strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S",
×tamp_tm);
strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S",
×tamp_tm);
@@
-118,8
+115,7
@@
static void logfile_print(const char *msg, int severity,
pthread_mutex_lock(&file_lock);
if (log_file == NULL) {
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)
} else if (strcasecmp(log_file, "stderr") == 0)
fh = stderr;
else if (strcasecmp(log_file, "stdout") == 0)
@@
-131,8
+127,7
@@
static void logfile_print(const char *msg, int severity,
if (fh == NULL) {
char errbuf[1024];
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)
sstrerror(errno, errbuf, sizeof(errbuf)));
} else {
if (print_timestamp)