diff options
author | Scott Moser <smoser@ubuntu.com> | 2010-06-17 11:29:34 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2010-06-17 11:29:34 -0400 |
commit | afb5f8da541f97a9fc5c023cac7dc55b5b81dd06 (patch) | |
tree | c2ee0bb23d94f69e5650b728938ab5f7e1e13f56 /cloud-init-cfg.py | |
parent | a9f600c4fb7426661c478f043791795ddbabb69a (diff) | |
download | vyos-cloud-init-afb5f8da541f97a9fc5c023cac7dc55b5b81dd06.tar.gz vyos-cloud-init-afb5f8da541f97a9fc5c023cac7dc55b5b81dd06.zip |
add initial logging support
This logging infrastructure in cloudinit:
- uses python logging
- allows user supplied config of logging.config.fileConfig format to be
supplied in /etc/cloud/cloud.cfg or in cloud_config by user data.
- by default, tries to use syslog, if that is not available, writes directly to
/var/log/cloud-init.log (syslog will not be available yet when cloud-init
runs)
- when using syslog, the doc/21-cloudinit.conf file provides a rsyslogd
file to be placed in /etc/rsyslog.d/ that will file [CLOUDINIT] messages
to /var/log/cloud-init.log
Diffstat (limited to 'cloud-init-cfg.py')
-rwxr-xr-x | cloud-init-cfg.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cloud-init-cfg.py b/cloud-init-cfg.py index 8684c532..2ef9bb04 100755 --- a/cloud-init-cfg.py +++ b/cloud-init-cfg.py @@ -19,6 +19,9 @@ import sys import cloudinit +import cloudinit.CloudConfig +import logging +import os def Usage(out = sys.stdout): out.write("Usage: %s name\n" % sys.argv[0]) @@ -33,8 +36,11 @@ def main(): name=sys.argv[1] run_args=sys.argv[2:] - import cloudinit.CloudConfig - import os + cloudinit.logging_set_from_cfg_file() + log = logging.getLogger() + log.info("cloud-init-cfg %s" % sys.argv[1:]) + + cloud = cloudinit.CloudInit() cfg_path = cloudinit.cloud_config cfg_env_name = cloudinit.cfg_env_name |