Skip to content

Commit

Permalink
More logging of the logs module
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Lahnakoski committed Jan 16, 2014
1 parent 710c5a8 commit a0f3a05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
12 changes: 5 additions & 7 deletions bzETL/util/logs.py
Expand Up @@ -288,19 +288,17 @@ def time_delta_pusher(please_stop, appender, queue, interval):
else:
lines.append(expand_template(log.get("template", None), log.get("params", None)))
except Exception, e:
if DEBUG_LOGGING:
sys.stdout.write("Trouble formatting logs: " + e.message)
raise e
sys.stderr.write("Trouble formatting logs: " + e.message)
# SWALLOW ERROR, GOT TO KEEP RUNNNIG
try:
if DEBUG_LOGGING and please_stop:
sys.stdout.write("Last call to appender with " + str(len(lines)) + " lines\n")
sys.stdout.write("Call to appender with " + str(len(lines)) + " lines\n")
appender(u"\n".join(lines) + u"\n")
if DEBUG_LOGGING and please_stop:
sys.stdout.write("Done call to appender with " + str(len(lines)) + " lines\n")
except Exception, e:
if DEBUG_LOGGING:
sys.stdout.write("Trouble with appender: " + e.message)
raise e
sys.stderr.write("Trouble with appender: " + e.message)
# SWALLOW ERROR, GOT TO KEEP RUNNNIG


class Log_usingStream(BaseLog):
Expand Down
9 changes: 7 additions & 2 deletions bzETL/util/threads.py
Expand Up @@ -14,6 +14,7 @@
import threading
import thread
import time
import sys
from .struct import nvl


Expand Down Expand Up @@ -225,8 +226,12 @@ def _run(self):
except Exception, e:
with self.synch_lock:
self.response={"exception":e}
from .logs import Log
Log.error("Problem in thread", e)
try:
from .logs import Log
Log.error("Problem in thread {{name}}", {"name":self.name}, e)
except Exception, f:
sys.stderr.write("ERROR: "+str(self.name)+" "+str(e.message))
sys.stderr.write("ERROR: "+str(self.name)+" "+str(f.message))
finally:
self.stopped.go()
del self.target, self.args, self.kwargs
Expand Down

0 comments on commit a0f3a05

Please sign in to comment.