]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3427] Changes after review
authorTomek Mrugalski <tomasz@isc.org>
Fri, 8 Aug 2014 09:42:12 +0000 (11:42 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 8 Aug 2014 09:42:12 +0000 (11:42 +0200)
 - logger names are now kea-dhcp4, kea-dhcp6, kea-dhcp-ddns
 - fix in keactrl_tests
 - User's Guide, examples updated

12 files changed:
doc/examples/kea4/several-subnets.json
doc/examples/kea4/single-subnet.json
doc/examples/kea6/several-subnets.json
doc/examples/kea6/simple.json
doc/guide/logging.xml
src/bin/dhcp4/kea_controller.cc
src/bin/dhcp4/main.cc
src/bin/dhcp4/tests/dhcp4_process_tests.sh.in
src/bin/dhcp6/kea_controller.cc
src/bin/dhcp6/main.cc
src/bin/dhcp6/tests/dhcp6_process_tests.sh.in
src/bin/keactrl/tests/keactrl_tests.sh.in

index ce88d84bc483d6484cea7a3bbaf58e4a39f5c595..ce8cb984ebd46a2eb35f903ff092f03807919c65 100644 (file)
@@ -40,7 +40,7 @@
 "Logging": {
     "loggers": [
         {
-            "name": "kea",
+            "name": "kea-dhcp4",
             "output_options": [
                 {
                     "output": "/var/log/kea-debug.log"
index c7a2d6705df0e0d36ba25a2cf23b75157fc64f88..6bb92ba27a994d00d950f5d0eec804113c90e66d 100644 (file)
@@ -42,7 +42,7 @@
 "Logging": {
     "loggers": [
         {
-            "name": "kea",
+            "name": "kea-dhcp4",
             "output_options": [
                 {
                     "output": "stdout"
index 38528f32c8ce15ca4d4c2c6d9a54acf3b0e414cb..420596da9f91e7644b6c003b5b687356345f0edf 100644 (file)
@@ -44,7 +44,7 @@
 "Logging": {
     "loggers": [
         {
-            "name": "kea",
+            "name": "kea-dhcp6",
             "output_options": [
                 {
                     "output": "stdout"
index 65872810985557096125e89dd52b981faa6121c4..ff3c6c1ed280279e4b4e7f89d6269f98c90c7c44 100644 (file)
@@ -43,7 +43,7 @@
 "Logging": {
     "loggers": [
         {
-            "name": "kea",
+            "name": "kea-dhcp6",
             "output_options": [
                 {
                     "output": "/var/log/kea-debug.log"
index 9f8ca09a27e2fd963950a64163dd7c8b5ce7f372..d765821f84fe9da038b7f70c036ae4de2f61c257 100644 (file)
@@ -125,15 +125,14 @@ Right now you can only see what their names are if they are running
         <para>
 
           One final note about the naming. When specifying the
-          module name within a logger, use the name of the module
-          as specified in JSON configuration, e.g.
-          <quote>Dhcp4</quote> for the Dhcp4 module,
-          <quote>Dhcp6</quote> for the Dhcp6 module, etc. When
+          module name within a logger, use the name of the binary file,
+          e.g. <quote>kea-dhcp4</quote> for the DHCPv4 module,
+          <quote>kea-dhcp6</quote> for the DHCPv6 module, etc. When
           the message is logged, the message will include the name
           of the logger generating the message, but with the module
           name replaced by the name of the process implementing
           the module (so for example, a message generated by the
-          <quote>Dhcp4</quote> logger will appear in the output
+          <quote>DHCPv4</quote> logger will appear in the output
           with a logger name of <quote>kea-dhcp4</quote>).
 
         </para>
@@ -143,19 +142,23 @@ Right now you can only see what their names are if they are running
         </para>
         <itemizedlist>
           <listitem>
-            <simpara>kea.dhcp4</simpara>
+            <simpara>kea-dhcp4.dhcp4</simpara>
           </listitem>
           <listitem>
-            <simpara>kea.dhcp6</simpara>
+            <simpara>kea-dhcp6.dhcp6</simpara>
           </listitem>
           <listitem>
             <simpara>kea-dhcp-ddns.dhcpddns</simpara>
           </listitem>
           <listitem>
-            <simpara>kea.dhcpsrv</simpara>
+            <simpara>kea-dhcp4.dhcpsrv</simpara>
+          </listitem>
+          <listitem>
+            <simpara>kea-dhcp6.dhcpsrv</simpara>
           </listitem>
         </itemizedlist>
 
+        <para>Additional loggers may be defined in the future.</para>
         </section>
 
         <section>
@@ -405,7 +408,7 @@ TODO; there's a ticket to determine these levels, see #1074
 "Logging": {
     "loggers": [
         {
-            "name": "kea",
+            "name": "kea-dhcp4",
             "output_options": [
                 {
                     "output": "stdout"
@@ -427,7 +430,7 @@ file be created.</para>
 "Logging": {
     "loggers": [
         {
-            "name": "kea",
+            "name": "kea-dhcp6",
             "output_options": [
                 {
                     "output": "/var/log/kea-debug.log",
index 6eb69bf90832a8935c14c2a8d46ec01948134205..267845ed1f0bb634396c328dcf65e8783df38795 100644 (file)
@@ -181,10 +181,10 @@ void ControlledDhcpv4Srv::cleanup() {
 /// This is a logger initialization for JSON file backend.
 /// For now, it's just setting log messages to be printed on stdout.
 /// @todo: Implement this properly (see #3427)
-void Daemon::loggerInit(const char*, bool verbose) {
+void Daemon::loggerInit(const char* logger_name, bool verbose) {
 
     setenv("B10_LOCKFILE_DIR_FROM_BUILD", "/tmp", 1);
-    setenv("B10_LOGGER_ROOT", "kea", 0);
+    setenv("B10_LOGGER_ROOT", logger_name, 0);
     setenv("B10_LOGGER_SEVERITY", (verbose ? "DEBUG":"INFO"), 0);
     setenv("B10_LOGGER_DBGLEVEL", "99", 0);
     setenv("B10_LOGGER_DESTINATION",  "stdout", 0);
index 656ea6849d6156f69322ea9b269ac60949b6cbc6..e4796d3583847c19000ecc18d922facce0f4cfdf 100644 (file)
@@ -39,7 +39,7 @@ namespace {
 
 const char* const DHCP4_NAME = "kea-dhcp4";
 
-const char* const DHCP4_LOGGER_NAME = "kea";
+const char* const DHCP4_LOGGER_NAME = "kea-dhcp4";
 
 void
 usage() {
@@ -101,7 +101,6 @@ main(int argc, char* argv[]) {
 
     try {
         // Initialize logging.  If verbose, we'll use maximum verbosity.
-        // If standalone is enabled, do not buffer initial log messages
         Daemon::loggerInit(DHCP4_LOGGER_NAME, verbose_mode);
         LOG_DEBUG(dhcp4_logger, DBG_DHCP4_START, DHCP4_START_INFO)
             .arg(getpid()).arg(port_number).arg(verbose_mode ? "yes" : "no");
@@ -118,15 +117,18 @@ main(int argc, char* argv[]) {
             // Initialize the server.
             server.init(config_file);
         } catch (const std::exception& ex) {
-            LOG_ERROR(dhcp4_logger, DHCP4_INIT_FAIL).arg(ex.what());
 
-            // We should not continue if were told to configure (either read
-            // config file or establish Bundy control session).
-
-            isc::log::LoggerManager log_manager;
-            log_manager.process();
+            try {
+                // Let's log out what went wrong.
+                isc::log::LoggerManager log_manager;
+                log_manager.process();
+                LOG_ERROR(dhcp4_logger, DHCP4_INIT_FAIL).arg(ex.what());
+            } catch (...) {
+                // The exeption thrown during the initialization could originate
+                // from logger subsystem. Therefore LOG_ERROR() may fail as well.
+                cerr << "Failed to initialize server: " << ex.what() << endl;
+            }
 
-            cerr << "Failed to initialize server: " << ex.what() << endl;
             return (EXIT_FAILURE);
         }
 
index 028cef53dfd1e9e6dbaa11389d560e1da4796c4a..81704554cb59778ff2ae963fd57a5dc33cecb5b7 100755 (executable)
@@ -40,7 +40,7 @@ CONFIG="{
     {
         \"loggers\": [
         {
-            \"name\": \"kea\",
+            \"name\": \"kea-dhcp4\",
             \"output_options\": [
                 {
                     \"output\": \"$LOG_FILE\"
@@ -76,7 +76,7 @@ CONFIG_INVALID="{
     {
         \"loggers\": [
         {
-            \"name\": \"kea\",
+            \"name\": \"kea-dhcp4\",
             \"output_options\": [
                 {
                     \"output\": \"$LOG_FILE\"
index 1d65f29a44a1d120628de6d970f9b608d521aa16..1452f1f15a6c9819a25ca38626daa3d6cd61a7fb 100644 (file)
@@ -181,10 +181,10 @@ void ControlledDhcpv6Srv::cleanup() {
 /// This is a logger initialization for JSON file backend.
 /// For now, it's just setting log messages to be printed on stdout.
 /// @todo: Implement this properly (see #3427)
-void Daemon::loggerInit(const char*, bool verbose) {
+void Daemon::loggerInit(const char* logger_name, bool verbose) {
 
     setenv("B10_LOCKFILE_DIR_FROM_BUILD", "/tmp", 1);
-    setenv("B10_LOGGER_ROOT", "kea", 0);
+    setenv("B10_LOGGER_ROOT", logger_name, 0);
     setenv("B10_LOGGER_SEVERITY", (verbose ? "DEBUG":"INFO"), 0);
     setenv("B10_LOGGER_DBGLEVEL", "99", 0);
     setenv("B10_LOGGER_DESTINATION",  "stdout", 0);
index 237cb0c371d0e2faaee8d64999d995304857c1bd..b8844260e153cd3213820ed583c5828dd01797d1 100644 (file)
@@ -39,7 +39,7 @@ using namespace std;
 namespace {
 const char* const DHCP6_NAME = "kea-dhcp6";
 
-const char* const DHCP6_LOGGER_NAME = "kea";
+const char* const DHCP6_LOGGER_NAME = "kea-dhcp6";
 
 void
 usage() {
@@ -121,14 +121,18 @@ main(int argc, char* argv[]) {
             server.init(config_file);
 
         } catch (const std::exception& ex) {
-            LOG_ERROR(dhcp6_logger, DHCP6_INIT_FAIL).arg(ex.what());
 
-            // We should not continue if were told to configure (either read
-            // config file or establish BIND10 control session).
-            isc::log::LoggerManager log_manager;
-            log_manager.process();
+            try {
+                // Let's log out what went wrong.
+                isc::log::LoggerManager log_manager;
+                log_manager.process();
+                LOG_ERROR(dhcp6_logger, DHCP6_INIT_FAIL).arg(ex.what());
+            } catch (...) {
+                // The exeption thrown during the initialization could originate
+                // from logger subsystem. Therefore LOG_ERROR() may fail as well.
+                cerr << "Failed to initialize server: " << ex.what() << endl;
+            }
 
-            cerr << "Failed to initialize server: " << ex.what() << endl;
             return (EXIT_FAILURE);
         }
 
index 4553ea08a3f8bd48b2fdbb0f554211a7776534a0..75e9d0a62ac4ee67a496f0c64a1f190e8ec5aa37 100755 (executable)
@@ -41,7 +41,7 @@ CONFIG="{
     {
         \"loggers\": [
         {
-            \"name\": \"kea\",
+            \"name\": \"kea-dhcp6\",
             \"output_options\": [
                 {
                     \"output\": \"$LOG_FILE\"
@@ -78,7 +78,7 @@ CONFIG_INVALID="{
     {
         \"loggers\": [
         {
-            \"name\": \"kea\",
+            \"name\": \"kea-dhcp6\",
             \"output_options\": [
                 {
                     \"output\": \"$LOG_FILE\"
index b54fd9c61bbe44d67641fb1d88c62b170475f877..102c8f30ef01da15c6a9ced9405f75aef6fc9e93 100644 (file)
@@ -75,6 +75,21 @@ config="{
         \"tsig_keys\": [],
         \"forward_ddns\" : {},
         \"reverse_ddns\" : {}
+    },
+
+    \"Logging\":
+    {
+        \"loggers\": [
+        {
+            \"name\": \"*\",
+            \"output_options\": [
+                {
+                    \"output\": \"$LOG_FILE\"
+                }
+            ],
+            \"severity\": \"INFO\"
+        }
+        ]
     }
 }"