From 4c7bc8b661250bb7fe1000ae1515507c5bf4beb1 Mon Sep 17 00:00:00 2001 From: Azul Date: Sat, 23 Nov 2013 10:35:40 +0100 Subject: more verbose error logging - also print the doc we tried --- files/couch-doc-update | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/files/couch-doc-update b/files/couch-doc-update index 625847f..9101802 100644 --- a/files/couch-doc-update +++ b/files/couch-doc-update @@ -38,11 +38,17 @@ def main exit 0 if result['ok'] raise StandardError.new(result.inspect) rescue StandardError => exc - $stderr.puts "ERROR: " + exc.to_s + db_without_password = db.to_s.sub(/:[^\/]*@/, ':PASSWORD_HIDDEN@') + log "ERROR: " + exc.to_s + log " failed writing to #{db_without_password}/#{id}" + exit 1 +end + +def log(message) + $stderr.puts message Syslog.open do |logger| - logger.log(Syslog::LOG_CRIT, exc.to_s) + logger.log(Syslog::LOG_CRIT, message) end - exit 1 end def process_options -- cgit v1.2.3