   (try 
     ((:sensor-fn sensor-def))
     (catch Exception ex
-      (log/error "Error polling sensor" (:sensor-name sensor-def) (str ex))
+      (log/error (str "Error polling sensor: " (:sensor-name sensor-def)
+                      " (" (.getMessage ex) ")"))
       false)))
 
 (defn process-sensor-reading [ sensor-name ts-sensor-reading ]

(defn post-readings [ url readings ]
  (log/debug "Posting" (count readings) "reading(s) to" url)
  (let [post-response
        (http/post url {:content-type "application/transit+json"
                        :body (pr-transit readings)}) ]
    (= (:status post-response) 200)))

(defn update-vault []
  (locking update-queue
    (when-let [ snapshot (take-result-queue-snapshot) ]
      (.addAll update-queue snapshot))
    (unless (.isEmpty update-queue)
            (when (post-readings vault-url (clean-readings (seq update-queue)))
              (.clear update-queue)))))

(defn maybe-load-config-file [ filename ]
  (binding [ *ns* (find-ns 'metlog-agent.core)]

    (doseq [ ts-sensor-reading (->timestamped-readings (poll-sensor sensor-def)) ]
      (process-sensor-reading (:sensor-name sensor-def) ts-sensor-reading))))

(defn take-result-queue-snapshot [ snapshot-size-limit ]
  (let [ snapshot (java.util.concurrent.LinkedBlockingQueue.) ]
    (locking sensor-result-queue
      (log/info "Taking snapshot queue with n:" (.size sensor-result-queue) ", limit:" snapshot-size-limit)
      (.drainTo sensor-result-queue snapshot snapshot-size-limit ))
    (seq snapshot)))

(def update-queue (java.util.concurrent.LinkedBlockingQueue.))
