summaryrefslogtreecommitdiffstats
path: root/ipalib/plugable.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/plugable.py')
-rw-r--r--ipalib/plugable.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index cf2919f1..2c862a95 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -568,9 +568,13 @@ class API(DictProxy):
try:
os.makedirs(log_dir)
except OSError:
- log.warn('Could not create log_dir %r', log_dir)
+ log.error('Could not create log_dir %r', log_dir)
return
- handler = logging.FileHandler(self.env.log)
+ try:
+ handler = logging.FileHandler(self.env.log)
+ except IOError, e:
+ log.error('Cannot open log file %r: %s', self.env.log, e.strerror)
+ return
handler.setFormatter(util.LogFormatter(FORMAT_FILE))
if self.env.debug:
handler.setLevel(logging.DEBUG)