BIND 10 trac930, updated. 814c513dcee8573b50b58104e9378b3be6899c5e [trac930] modify logging add loggings and new messages for logging remove unused messages from the message file add test logging names into unittest scripts

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jul 28 13:06:58 UTC 2011


The branch, trac930 has been updated
       via  814c513dcee8573b50b58104e9378b3be6899c5e (commit)
      from  b7a511e6d3067c9b364c337d34b600f88a02d7be (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 814c513dcee8573b50b58104e9378b3be6899c5e
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Thu Jul 28 22:07:15 2011 +0900

    [trac930] modify logging
    add loggings and new messages for logging
    remove unused messages from the message file
    add test logging names into unittest scripts

-----------------------------------------------------------------------

Summary of changes:
 src/bin/stats/stats.py.in                   |   22 +++++++++++++---------
 src/bin/stats/stats_httpd.py.in             |    3 +--
 src/bin/stats/stats_messages.mes            |   21 +++++++++++----------
 src/bin/stats/tests/b10-stats-httpd_test.py |    3 +++
 src/bin/stats/tests/b10-stats_test.py       |    3 +++
 5 files changed, 31 insertions(+), 21 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in
index 0d43570..ca206bf 100644
--- a/src/bin/stats/stats.py.in
+++ b/src/bin/stats/stats.py.in
@@ -148,9 +148,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)
@@ -281,7 +279,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))
@@ -306,9 +304,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 = {}
@@ -364,10 +366,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)
diff --git a/src/bin/stats/stats_httpd.py.in b/src/bin/stats/stats_httpd.py.in
index cc9c604..32ec6b7 100755
--- a/src/bin/stats/stats_httpd.py.in
+++ b/src/bin/stats/stats_httpd.py.in
@@ -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)
 
diff --git a/src/bin/stats/stats_messages.mes b/src/bin/stats/stats_messages.mes
index 9ad07cf..cfffb3a 100644
--- a/src/bin/stats/stats_messages.mes
+++ b/src/bin/stats/stats_messages.mes
@@ -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.
diff --git a/src/bin/stats/tests/b10-stats-httpd_test.py b/src/bin/stats/tests/b10-stats-httpd_test.py
index 2cc78dd..89dea29 100644
--- a/src/bin/stats/tests/b10-stats-httpd_test.py
+++ b/src/bin/stats/tests/b10-stats-httpd_test.py
@@ -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"
diff --git a/src/bin/stats/tests/b10-stats_test.py b/src/bin/stats/tests/b10-stats_test.py
index 640b796..4c6bde0 100644
--- a/src/bin/stats/tests/b10-stats_test.py
+++ b/src/bin/stats/tests/b10-stats_test.py
@@ -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      },




More information about the bind10-changes mailing list