diff --git a/.gitignore b/.gitignore index 2e6c10af900..a23cbfc48c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +home-assistant.log home-assistant.conf known_devices.csv diff --git a/homeassistant/__init__.py b/homeassistant/__init__.py index 15c7826e105..c34de361cbe 100644 --- a/homeassistant/__init__.py +++ b/homeassistant/__init__.py @@ -13,8 +13,6 @@ import datetime as dt import homeassistant.util as util -logging.basicConfig(level=logging.INFO) - MATCH_ALL = '*' DOMAIN = "homeassistant" diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 7d41c3dbf56..1bc6ef19edb 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -15,6 +15,18 @@ def from_config_file(config_path): """ Starts home assistant with all possible functionality based on a config file. """ + # Setup the logging for home assistant. + logging.basicConfig(level=logging.INFO) + + # Log errors to a file + err_handler = logging.FileHandler("home-assistant.log", mode='w') + err_handler.setLevel(logging.ERROR) + err_handler.setFormatter( + logging.Formatter('%(asctime)s %(name)s: %(message)s', + datefmt='%H:%M %d-%m-%y')) + logging.getLogger('').addHandler(err_handler) + + # Start the actual bootstrapping logger = logging.getLogger(__name__) statusses = []