summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNagappan Alagappan <nagappan@gmail.com>2013-09-28 21:54:52 -0700
committerNagappan Alagappan <nagappan@gmail.com>2013-09-28 21:54:52 -0700
commite513654c69c341040256033f12d86f1b97d22a1b (patch)
treeee1a031ab0e25548b081ad7801a4b55709f36c15
parent62d1bfb7024817ad119bf4468c81bbf988fc553d (diff)
Update traceback to log file, if LDTP_DEBUG_FILE environment variable is set
-rw-r--r--ldtpd/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ldtpd/__init__.py b/ldtpd/__init__.py
index 399396f..da0a328 100644
--- a/ldtpd/__init__.py
+++ b/ldtpd/__init__.py
@@ -68,6 +68,7 @@ def main(port=4118, parentpid=None):
import traceback
_ldtp_debug = os.environ.get('LDTP_DEBUG', None)
+ _ldtp_debug_file = os.environ.get('LDTP_DEBUG_FILE', None)
try:
pyatspi.setCacheLevel(pyatspi.CACHE_PROPERTIES)
@@ -83,3 +84,6 @@ def main(port=4118, parentpid=None):
except socket.error:
if _ldtp_debug:
print(traceback.format_exc())
+ if _ldtp_debug_file:
+ with open(_ldtp_debug_file, "a") as fp:
+ fp.write(traceback.format_exc())