diff --git a/bin/netsvc.py b/bin/netsvc.py index 8123db83d47..6894ea7d1da 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -173,7 +173,7 @@ class Logger(object): msg = tools.exception_to_unicode(msg) try: - if level in (LOG_ERROR,LOG_CRITICAL): + if level in (LOG_ERROR,LOG_CRITICAL) and tools.config.get_misc('debug','env_info',True): msg = common().get_server_environment() + msg result = tools.ustr(msg).strip().split('\n') diff --git a/bin/tools/config.py b/bin/tools/config.py index 2c83a3c464f..3e9bcf2f7eb 100644 --- a/bin/tools/config.py +++ b/bin/tools/config.py @@ -81,6 +81,8 @@ class configmanager(object): 'cache_timeout': 100000, 'login_message': False, } + + self.misc = {} hasSSL = check_ssl() @@ -337,6 +339,18 @@ class configmanager(object): if value=='False' or value=='false': value = False self.options[name] = value + #parse the other sections, as well + for sec in p.sections(): + if sec == 'options': + continue + if not self.misc.has_key(sec): + self.misc[sec]= {} + for (name, value) in p.items(sec): + if value=='True' or value=='true': + value = True + if value=='False' or value=='false': + value = False + self.misc[sec][name] = value except IOError: pass except ConfigParser.NoSectionError: @@ -353,6 +367,10 @@ class configmanager(object): p.set('options', opt, loglevelnames.get(self.options[opt], self.options[opt])) else: p.set('options', opt, self.options[opt]) + + for sec in self.misc.keys(): + for opt in self.misc[sec].keys(): + p.set(sec,opt,self.misc[sec][opt]) # try to create the directories and write the file try: @@ -371,6 +389,9 @@ class configmanager(object): def get(self, key, default=None): return self.options.get(key, default) + def get_misc(self, sect, key, default=None): + return self.misc.get(sect,{}).get(key, default) + def __setitem__(self, key, value): self.options[key] = value