summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2014-04-24 16:35:18 +0200
committerJan Synacek <jsynacek@redhat.com>2014-04-25 09:39:27 +0200
commitfb37c3b6db9313f9b24a25820c7f2ad8fdc85b94 (patch)
tree37a0c1ec22064bc08f73015cdd71d01072c36c58
parent9cef7c103150e171e52a4422bd54c87ed88a9eec (diff)
downloadopenlmi-providers-fb37c3b6db9313f9b24a25820c7f2ad8fdc85b94.tar.gz
openlmi-providers-fb37c3b6db9313f9b24a25820c7f2ad8fdc85b94.tar.xz
openlmi-providers-fb37c3b6db9313f9b24a25820c7f2ad8fdc85b94.zip
common: logging fixes
Fix top level configuration defaults. Add warning when attempting to parse non-existent group or key from a key file. Correct loglevel comment in configuration.
-rw-r--r--src/common/openlmi.c10
-rw-r--r--src/common/openlmi.conf6
2 files changed, 9 insertions, 7 deletions
diff --git a/src/common/openlmi.c b/src/common/openlmi.c
index 2391062..508ffba 100644
--- a/src/common/openlmi.c
+++ b/src/common/openlmi.c
@@ -56,8 +56,8 @@ static bool _log_stderr = false;
static ConfigEntry _toplevel_config_defaults[] = {
{ "CIM", "Namespace", "root/cimv2" },
{ "CIM", "SystemClassName", "PG_ComputerSystem" },
- { "LOG", "Level", "ERROR" },
- { "LOG", "Stderr" , "false" },
+ { "Log", "Level", "ERROR" },
+ { "Log", "Stderr" , "false" },
{ NULL, NULL, NULL }
};
@@ -157,7 +157,11 @@ char *lmi_read_config(const char *group, const char *key)
lmi_warn("Attempted to read config file before calling lmi_init");
return NULL;
}
- return g_key_file_get_string(_masterKeyFile, group, key, NULL);
+ char *result = g_key_file_get_string(_masterKeyFile, group, key, NULL);
+ if (result == NULL) {
+ lmi_warn("Attempted to read unknown group/key: %s/%s", group, key);
+ }
+ return result;
}
bool lmi_read_config_boolean(const char *group, const char *key)
diff --git a/src/common/openlmi.conf b/src/common/openlmi.conf
index 64684a8..b86e3d9 100644
--- a/src/common/openlmi.conf
+++ b/src/common/openlmi.conf
@@ -13,10 +13,8 @@
# by CIMOM.
# Level can be set to following values:
-# TRACE_VERBOSE, TRACE_INFO, TRACE_WARNING, DEBUG, INFO, WARNING, ERROR, CRITICAL
-# It does not have any effect, if file_config option is set.
+# DEBUG, INFO, WARNING, ERROR
#Level = ERROR
-# If logging to stderr is desired, set this option to True. This option won't
-# apply if file_config option is set.
+# If logging to stderr is desired, set this option to True.
#Stderr = False