qubes/vm: fix logging

This commit is contained in:
Wojtek Porczyk 2015-01-21 17:03:17 +01:00
parent 45977fc873
commit 186b277418
2 changed files with 10 additions and 2 deletions

View File

@ -1123,6 +1123,7 @@ class Qubes(PropertyHolder):
def __init__(self, store='/var/lib/qubes/qubes.xml'):
super(Qubes, self).__init__(xml=None)
#: logger instance for logging global messages
self.log = logging.getLogger('app')
# pylint: disable=no-member

View File

@ -41,6 +41,7 @@ import xml.parsers.expat
import lxml.etree
import qubes
import qubes.log
import qubes.events
import qubes.plugins
@ -180,8 +181,6 @@ class BaseVM(qubes.PropertyHolder):
# check if properties are appropriate
all_names = set(prop.__name__ for prop in self.property_list())
sys.stderr.write('all_names={!r}\n'.format(all_names))
for node in self.xml.xpath('./properties/property'):
name = node.get('name')
if not name in all_names:
@ -189,6 +188,14 @@ class BaseVM(qubes.PropertyHolder):
'property {!r} not applicable to {!r}'.format(
name, self.__class__.__name__))
#: logger instance for logging messages related to this VM
self.log = None
def init_log(self):
'''Initialise logger for this domain.'''
self.log = qubes.log.get_vm_logger(self.name)
def add_new_vm(self, vm):
'''Add new Virtual Machine to colletion