summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Touceda <chiiph@leap.se>2013-04-25 13:20:01 -0300
committerTomas Touceda <chiiph@leap.se>2013-04-25 13:20:01 -0300
commit7837a2227fef6f443114cb9f6d3521bab31495d2 (patch)
tree23bc9aa3676c8a3ba559d29910fc1cf07131a2fc
parentff2cef754702d98dff2d2c63f18130ca7afab617 (diff)
Add logfile capabilities
-rwxr-xr-xstart_mx.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/start_mx.py b/start_mx.py
index 7e154da..bf3dddb 100755
--- a/start_mx.py
+++ b/start_mx.py
@@ -55,6 +55,7 @@ if __name__ == "__main__":
debug = opts.debug
config_file = opts.config
+ logfile = opts.log_file
if debug:
level = logging.DEBUG
@@ -73,6 +74,13 @@ if __name__ == "__main__":
console.setFormatter(formatter)
logger.addHandler(console)
+ if logfile is not None:
+ logger.debug('Setting logfile to %s ', logfile)
+ fileh = logging.FileHandler(logfile)
+ fileh.setLevel(logging.DEBUG)
+ fileh.setFormatter(formatter)
+ logger.addHandler(fileh)
+
logger.info("~~~~~~~~~~~~~~~~~~~")
logger.info(" LEAP MX")
logger.info("~~~~~~~~~~~~~~~~~~~")