From afb5f8da541f97a9fc5c023cac7dc55b5b81dd06 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 17 Jun 2010 11:29:34 -0400 Subject: 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 --- cloudinit/DataSourceEc2.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cloudinit/DataSourceEc2.py') diff --git a/cloudinit/DataSourceEc2.py b/cloudinit/DataSourceEc2.py index ad88a704..ebee61c6 100644 --- a/cloudinit/DataSourceEc2.py +++ b/cloudinit/DataSourceEc2.py @@ -126,14 +126,14 @@ class DataSourceEc2(DataSource.DataSource): reason = "url error [%s]" % e.reason if x == 0: - sys.stderr.write("waiting for metadata service at %s\n" % url) + cloudinit.log.warning("waiting for metadata service at %s\n" % url) - sys.stderr.write(" %s [%02s/%s]: %s\n" % - (time.strftime("%H:%M:%S"), x+1, sleeps, reason)) + cloudinit.log.warning(" %s [%02s/%s]: %s\n" % + (time.strftime("%H:%M:%S"), x+1, sleeps, reason)) time.sleep(sleeptime) - sys.stderr.write("giving up on md after %i seconds\n" % - int(time.time()-starttime)) + log.critical("giving up on md after %i seconds\n" % + int(time.time()-starttime)) return False def get_public_ssh_keys(self): -- cgit v1.2.3