Skip to content

Commit

Permalink
fix logging config
Browse files Browse the repository at this point in the history
  • Loading branch information
jframos committed Nov 17, 2015
1 parent 49f7682 commit efb229c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions fiware-region-sanity-tests/.noserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[nosetests]
logging-filter=TestCase,novaclient,neutronclient
logging-level=ERROR
logging-format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
12 changes: 8 additions & 4 deletions fiware-region-sanity-tests/commons/fiware_cloud_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,17 +455,21 @@ def setUpClass(cls):
"""

# Initialize logger
cls.logger = logging.getLogger(PROPERTIES_LOGGER)

# Configure a new custom file handler for SanityChecks
# > Get logging configuration for Sanity Checks
config = ConfigParser()
config.read(LOGGING_FILE_SANITYCHECKS)

# > Configure a new custom file handler for SanityChecks
log_formatter = logging.Formatter(config.get('sanitychecks_formatter_fileFormatter', 'format', raw=True))
file_handler = logging.FileHandler(
config.get('sanitychecks_handler_fileHandler', 'filename').format(region_name=cls.region_name), mode='w')
file_handler.setFormatter(log_formatter)
file_handler.setLevel(config.get('sanitychecks_handler_fileHandler', 'level'))
cls.logger.addHandler(file_handler)

# > Set FileHandler for default root logger.
logging.getLogger('').addHandler(file_handler)

cls.logger = logging.getLogger(PROPERTIES_LOGGER)

# Load properties
cls.load_project_properties()
Expand Down
3 changes: 1 addition & 2 deletions fiware-region-sanity-tests/sanity_checks
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ export OS_TENANT_ID OS_TENANT_NAME OS_USER_DOMAIN_NAME
# Options for nosetests
TESTS=
NOSEOPTS="--logging-filter=TestCase,novaclient,neutronclient --logging-level=ERROR
--logging-format=\"%(asctime)s - %(name)s - %(levelname)s - %(message)s\""
NOSEOPTS="--config=.noserc"
# Available regions
REGIONS=$(sed -n '/"external_network_name"/,/}/ p' resources/settings.json \
Expand Down

0 comments on commit efb229c

Please sign in to comment.