'Logging is configured by a logging stanza.'

@_restore_logging(log_name='flocker.test')
def test_logging(self, log_name):

    host = '192.0.2.13'
    port = 2314
    name = u'from_config-test'
    logfile = self.make_temporary_path()
    log_config = {'version': 1, 'handlers': {'logfile': {'class': 'logging.FileHandler', 'level': 'DEBUG', 'filename': logfile.path, 'encoding': 'utf-8'}}, 'loggers': {log_name: {'handlers': ['logfile'], 'level': 'DEBUG'}}}
    setup_config(self, control_address=host, control_port=port, name=name, log_config=log_config)
    options = DatasetAgentOptions()
    options.parseOptions(['--agent-config', self.config.path])
    config = get_configuration(options)
    AgentService.from_configuration(config)
    log_message = 'My    LoG    tEsT.'
    logger = logging.getLogger(log_name)
    logger.info(log_message)
    self.assertIn(log_message, logfile.getContent())
