Commit eb4be17d authored by Naoki Kambe's avatar Naoki Kambe
Browse files

[trac930] modify logging add loggings and new messages for logging

remove unused messages from the message file add test logging names
into unittest scripts
parent ac06a06d
......@@ -156,9 +156,7 @@ class Stats:
Start stats module
"""
self.running = True
# TODO: should be added into new logging interface
# if self.verbose:
# sys.stdout.write("[b10-stats] starting\n")
logger.info(STATS_STARTING)
# request Bob to send statistics data
logger.debug(DBG_STATS_MESSAGING, STATS_SEND_REQUEST_BOSS)
......@@ -289,7 +287,7 @@ class Stats:
"""
handle show command
"""
if (owner or name):
if owner or name:
logger.debug(DBG_STATS_MESSAGING,
STATS_RECEIVED_SHOW_NAME_COMMAND,
str(owner)+", "+str(name))
......@@ -314,9 +312,13 @@ class Stats:
"""
handle show command
"""
# TODO: should be added into new logging interface
# if self.verbose:
# sys.stdout.write("[b10-stats] 'showschema' command received\n")
if owner or name:
logger.debug(DBG_STATS_MESSAGING,
STATS_RECEIVED_SHOWSCHEMA_NAME_COMMAND,
str(owner)+", "+str(name))
else:
logger.debug(DBG_STATS_MESSAGING,
STATS_RECEIVED_SHOWSCHEMA_ALL_COMMAND)
self.update_modules()
schema = {}
schema_byname = {}
......@@ -372,10 +374,12 @@ if __name__ == "__main__":
stats.start()
except OptionValueError as ove:
logger.fatal(STATS_BAD_OPTION_VALUE, ove)
sys.exit(1)
except SessionError as se:
logger.fatal(STATS_CC_SESSION_ERROR, se)
# TODO: should be added into new logging interface
sys.exit(1)
except StatsError as se:
sys.exit("[b10-stats] %s" % se)
logger.fatal(STATS_START_ERROR, se)
sys.exit(1)
except KeyboardInterrupt as kie:
logger.info(STATS_STOPPED_BY_KEYBOARD)
......@@ -301,8 +301,7 @@ class StatsHttpd:
# restore old config
self.load_config(old_config)
self.open_httpd()
return isc.config.ccsession.create_answer(
1, "[b10-stats-httpd] %s" % err)
return isc.config.ccsession.create_answer(1, str(err))
else:
return isc.config.ccsession.create_answer(0)
......
......@@ -28,16 +28,6 @@ control bus. A likely problem is that the message bus daemon
This debug message is printed when the stats module has received a
configuration update from the configuration manager.
% STATS_RECEIVED_REMOVE_COMMAND received command to remove %1
A remove command for the given name was sent to the stats module, and
the given statistics value will now be removed. It will not appear in
statistics reports until it appears in a statistics update from a
module again.
% STATS_RECEIVED_RESET_COMMAND received command to reset all statistics
The stats module received a command to clear all collected statistics.
The data is cleared until it receives an update from the modules again.
% STATS_RECEIVED_SHOW_ALL_COMMAND received command to show all statistics
The stats module received a command to show all statistics that it has
collected.
......@@ -72,4 +62,15 @@ installation problem, where the specification file stats.spec is
from a different version of BIND 10 than the stats module itself.
Please check your installation.
% STATS_STARTING starting
The stats module will be now starting.
% STATS_RECEIVED_SHOWSCHEMA_ALL_COMMAND received command to show all statistics schema
The stats module received a command to show all statistics schemas of all modules.
% STATS_RECEIVED_SHOWSCHEMA_NAME_COMMAND received command to show statistics schema for %1
The stats module received a command to show the specified statistics schema of the specified module.
% STATS_START_ERROR stats module error: %1
An internal error occurred while starting the stats module. The stats
module will be now shutting down.
......@@ -30,6 +30,9 @@ import stats_httpd
import stats
from test_utils import BaseModules, ThreadingServerManager, MyStats, MyStatsHttpd, TIMEOUT_SEC
# set test name for logger
isc.log.init("b10-stats-httpd_test")
DUMMY_DATA = {
'Boss' : {
"boot_time": "2011-03-04T11:59:06Z"
......
......@@ -24,6 +24,9 @@ import stats
import isc.cc.session
from test_utils import BaseModules, ThreadingServerManager, MyStats, send_command, TIMEOUT_SEC
# set test name for logger
isc.log.init("b10-stats_test")
class TestUtilties(unittest.TestCase):
items = [
{ 'item_name': 'test_int1', 'item_type': 'integer', 'item_default': 12345 },
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment