summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Touceda <chiiph@leap.se>2013-04-25 13:20:01 -0300
committerTomas Touceda <chiiph@leap.se>2013-05-07 14:02:12 -0300
commit4ed3e03aa4012905d04d62c1d34e3440f8e0dacc (patch)
tree92b0e1838d74d1893f6a0c0d0f5daf0510e2a7af
parentdd165dcbab7e686a238655fc68a5d7d472ee1736 (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("~~~~~~~~~~~~~~~~~~~")