Merge pull request #645 from manuelluis/mlsr/java-fix_cdtime
[collectd.git] / src / log_logstash.c
index 4b7790c..6cb5b0a 100644 (file)
@@ -36,7 +36,7 @@
 # define HAVE_YAJL_V2 1
 #endif
 
-#define DEFAULT_LOGFILE LOCALSTATEDIR"/log/collectd.json.log"
+#define DEFAULT_LOGFILE LOCALSTATEDIR"/log/"PACKAGE_NAME".json.log"
 
 #if COLLECT_DEBUG
 static int log_level = LOG_DEBUG;
@@ -60,8 +60,12 @@ static int log_logstash_config (const char *key, const char *value)
 
        if (0 == strcasecmp (key, "LogLevel")) {
                log_level = parse_log_severity(value);
-               printf("parsed log level: %d\n", log_level);
-               if (log_level == -1) return 1; /* to keep previous behaviour */
+        if (log_level < 0) {
+            log_level = LOG_INFO;
+            ERROR("log_logstash: invalid loglevel [%s] defaulting to 'info'",
+                  value);
+            return 1;
+        }
        }
        else if (0 == strcasecmp (key, "File")) {
                sfree (log_file);