]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[208-move-logging-from-global-objects-to-global-params] Almost done. Checkpoint of...
authorFrancis Dupont <fdupont@isc.org>
Mon, 7 Jan 2019 18:42:03 +0000 (19:42 +0100)
committerFrancis Dupont <fdupont@isc.org>
Wed, 22 May 2019 22:10:24 +0000 (18:10 -0400)
89 files changed:
doc/api/config-set.json
doc/api/config-test.json
doc/examples/agent/comments.json
doc/examples/agent/simple.json
doc/examples/ddns/comments.json
doc/examples/ddns/sample1.json
doc/examples/kea4/advanced.json
doc/examples/kea4/all-keys-current.json
doc/examples/kea4/all-keys-stable.json
doc/examples/kea4/backends.json
doc/examples/kea4/cassandra.json
doc/examples/kea4/classify.json
doc/examples/kea4/classify2.json
doc/examples/kea4/comments.json
doc/examples/kea4/dhcpv4-over-dhcpv6.json
doc/examples/kea4/global-reservations.json
doc/examples/kea4/ha-load-balancing-primary.json
doc/examples/kea4/leases-expiration.json
doc/examples/kea4/multiple-options.json
doc/examples/kea4/mysql-reservations.json
doc/examples/kea4/pgsql-reservations.json
doc/examples/kea4/reservations.json
doc/examples/kea4/several-subnets.json
doc/examples/kea4/single-subnet.json
doc/examples/kea4/with-ddns.json
doc/examples/kea6/advanced.json
doc/examples/kea6/all-keys-current.json
doc/examples/kea6/all-keys-stable.json
doc/examples/kea6/backends.json
doc/examples/kea6/cassandra.json
doc/examples/kea6/classify.json
doc/examples/kea6/classify2.json
doc/examples/kea6/comments.json
doc/examples/kea6/dhcpv4-over-dhcpv6.json
doc/examples/kea6/duid.json
doc/examples/kea6/global-reservations.json
doc/examples/kea6/ha-hot-standby.json
doc/examples/kea6/leases-expiration.json
doc/examples/kea6/multiple-options.json
doc/examples/kea6/mysql-reservations.json
doc/examples/kea6/pgsql-reservations.json
doc/examples/kea6/reservations.json
doc/examples/kea6/several-subnets.json
doc/examples/kea6/simple.json
doc/examples/kea6/softwire46.json
doc/examples/kea6/with-ddns.json
doc/examples/netconf/comments.json
doc/examples/netconf/kea-dhcp6-operations/netconf.json
doc/examples/netconf/simple-dhcp4.json
doc/examples/netconf/simple-dhcp6.json
doc/guide/agent.xml
doc/guide/api.xml
doc/guide/config.xml
doc/guide/ctrl-channel.xml
doc/guide/dhcp4-srv.xml
doc/guide/dhcp6-srv.xml
doc/guide/logging.xml
doc/guide/netconf.xml
src/bin/agent/ca_cfg_mgr.cc
src/bin/agent/parser_context.h
src/bin/d2/d2_cfg_mgr.cc
src/bin/d2/parser_context.h
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp4/ctrl_dhcp4_srv.h
src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp4/json_config_parser.cc
src/bin/dhcp4/parser_context.h
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/bin/dhcp6/ctrl_dhcp6_srv.h
src/bin/dhcp6/dhcp6_messages.mes
src/bin/dhcp6/json_config_parser.cc
src/bin/dhcp6/parser_context.h
src/bin/keactrl/kea-ctrl-agent.conf.pre
src/bin/keactrl/kea-dhcp-ddns.conf.pre
src/bin/keactrl/kea-dhcp4.conf.pre
src/bin/keactrl/kea-dhcp6.conf.pre
src/bin/keactrl/kea-netconf.conf.pre
src/bin/netconf/netconf_cfg_mgr.cc
src/bin/netconf/parser_context.h
src/lib/dhcpsrv/srv_config.cc
src/lib/process/config_base.cc
src/lib/process/config_base.h
src/lib/process/d_controller.cc
src/lib/process/d_controller.h
src/lib/process/daemon.cc
src/lib/process/daemon.h
src/lib/process/log_parser.cc
src/lib/process/log_parser.h
src/lib/process/tests/daemon_unittest.cc

index a6042f724c79cab88cb6376859799423f261b1df..ce0cb4b9ee7fdbcde9a6a2b46dd681dd5f27b154 100644 (file)
@@ -8,8 +8,6 @@
     \"command\": \"config-set\",
     \"arguments\":  {
         \"<server>\": {
-        },
-        \"Logging\": {
         }
      }
 }",
index 5bd1f004e5943db3553cd6c8ca5f80a74d38e28d..ea9f12f267f9c32f23b5bfedfb5ebdbe34629a0f 100644 (file)
@@ -8,8 +8,6 @@
     \"command\": \"config-test\",
     \"arguments\":  {
         \"<server>\": {
-        },
-        \"Logging\": {
         }
      }
 }",
index d0d0c107980a63640dc8b61c1f69f452685cc1b6..b6a717740e4a9fb58180f42e0afdae51280db7cc 100644 (file)
                 "socket-type": "unix",
                 "socket-name": "/path/to/the/unix/socket-v4"
             }
-        }
+        },
 
-    },
-
-    "Logging":
-    {
         // In loggers
         "loggers": [
             {
index b64a647a62f01a5e4a7acb295623e89b59f0cb88..7a531c931757880b3217dbc0e5e7daf171e13744 100644 (file)
                     "param1": "foo"
                 }
             }
-        ]
-
-    },
+        ],
 
-    // Similar to other Kea components, CA also uses logging.
-    "Logging":
-    {
+        // Similar to other Kea components, CA also uses logging.
         "loggers": [
             {
                 "name": "kea-ctrl-agent",
index f97005b0986a4943d6ced4141e7e39cd2cb0a661..0ee655cf2e002b6ca3bff9dad46498b7f3fb15a9 100644 (file)
             "algorithm": "HMAC-MD5",
             "secret": "LSWXnfkKZjdPJI5QxlpnfQ=="
         }
-    ]
-},
+    ],
 
-"Logging": {
     // In loggers
     "loggers": [
         {
index 890fc08adf1783ba4dee273e59cf5e91106da6a1..2e1ed1378bbab2da2a5502c0b0d6e5600095dea1 100644 (file)
             "digest-bits": 256,
             "secret": "/4wklkm04jeH4anx2MKGJLcya+ZLHldL5d6mK+4q6UXQP7KJ9mS2QG29hh0SJR4LA0ikxNJTUMvir42gLx6fGQ=="
         }
-    ]
-},
+    ],
 
 // The following configures logging. It assumes that messages with at least
 // informational level (info, warn, error and fatal) should be logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp-ddns",
index 00380e59e7dc2dda02760bf647ae13608a9e1863..38f71ed18ad3a986cfa17c44acb17933928e3b2a 100644 (file)
             "subnet": "192.0.5.0/24",
             "authoritative": true
         }
-    ]
-},
-
-  // The following configures logging. It assumes that messages with
-  // at least informational level (info, warn, error and fatal) should
-  // be logged to stdout.
-  "Logging": {
-      "loggers": [
+    ],
+
+    // The following configures logging. It assumes that messages with
+    // at least informational level (info, warn, error and fatal) should
+    // be logged to stdout.
+    "loggers": [
           {
             "name": "kea-dhcp4",
               "output_options": [
index 6a6457e95e0e3d9928a2a6b3cbdee287e8310a8d..ff53006d0441fca4b26ba099472a0da5406d7921 100644 (file)
         "t1-percent": .5,
 
         // T2 = valid lifetime * .75.
-        "t2-percent": .75
-
-    },
-
-    // Logging configuration begins here.
-    "Logging": {
+        "t2-percent": .75,
 
         // List of loggers used by the servers using this configuration file.
         "loggers": [
index 4728a5fb09ac7e936ed08e994b1b7fb830aaaf50..babcd8587f630a01f56365ee0e4d600e3238e154 100644 (file)
 
             // Queue type was mandatory.
             "queue-type": "kea-ring4"
-        }
+        },
        // Missing: calculate-tee-times, t1-percent, t2-percent
-    },
-
-    // Logging configuration begins here.
-    "Logging": {
 
         // List of loggers used by the servers using this configuration file.
         "loggers": [
index 47994bf25b71af54730a6d3007c4a6e87f83ae06..8238eaa71f1a75c159205d5f7f286bd4101baee0 100644 (file)
        "subnet": "192.0.2.0/24",
        "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index d891225b3e763707b93d7306d21cf6812d3a00c0..8d7d8504179732838537021ca6bf9eec3f786d85 100644 (file)
        "subnet": "192.0.2.0/24",
        "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index a44b030455c0a3a61c976fc227daa9977c66e61e..5a623b718f870f820a4e6ca7b54168d4396ec461 100644 (file)
         "subnet": "192.0.4.0/23",
         "interface": "ethY"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index f7cba5cc09335cd45ba45f2dc9a2cb34c7cfb985..e9d82ac7bd887198e6d12a48e0642e0e9a2e5851 100644 (file)
                 {  "hw-address": "00:00:00:aa:bb:cc", "hostname": "ha" }
             ]
         }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index 104e3479f8f1df213a0c6ce4bc71f62268a67be2..13831113ae6e6f97ffc88ad4ded70a3a5e2d03da 100644 (file)
    "dhcp-ddns": {
        "comment": "No dynamic DNS",
        "enable-updates": false
-   }
-},
+   },
 
-"Logging": {
    // In loggers
    "loggers": [ {
        "comment": "A logger",
index 1905cf8a36cd4ac01abf9a4cd33fd18a310f7db7..779041b172a8a93a51e740382c9447423b95a2ce 100644 (file)
   ],
 
 // This enables DHCPv4-over-DHCPv6 support
-  "dhcp4o6-port": 6767
+  "dhcp4o6-port": 6767,
 
-},
-
-"Logging":
-{
   "loggers": [
     {
       "name": "kea-dhcp4",
index 0be0be490a082db73f7a6df5bafabd3ba87316e6..155b56aeeaefc05e1862d3cef7b77c50e9a8cdaf 100644 (file)
        "subnet": "192.0.2.0/24",
        "interface": "eth0"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index 38500a90ddb0639da5995ef7458944a8343f2b30..6251f3cf47fa008e0987929c32874c2102342afa 100644 (file)
             // IP address.
             "relay": { "ip-address": "192.168.56.1" }
         }
-    ]
-},
+    ],
 
-// Logging configuration starts here.
-"Logging":
-{
-  "loggers": [
+    // Logging configuration starts here.
+    "loggers": [
     {
         // This section affects kea-dhcp4, which is the base logger for DHCPv4
         // component. It tells DHCPv4 server to write all log messages (on
index 4ce1a8cc23619630776177c60ac120f62e07b932..cc499aaeb3723959f523b178faa9f01c736c5ce1 100644 (file)
        "subnet": "192.0.2.0/24",
        "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index 6a45c3ef3f5ff26f29c76b18686062bc68cf6463..ee6fba747461378b4e5e6f216d90c73d772b1a8a 100644 (file)
                 }
           ]
         } ]
-    } ]
-},
+    } ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index 7e2c6d13df2694f1beb574a9861eff4cdeb60b46..01e1be67d471c570924087059b1ad5b48c4c3534 100644 (file)
        "interface": "ethX",
        "id": 1
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index a7c3edb4a3d78aebb009e69c9aabfb2279517801..921d2dc114446b3fa36a8ea0fef01f9d835a099a 100644 (file)
        "interface": "ethX",
        "id": 1
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index 0fcdb44b8fe065abb40732157cc70e94d5612a02..61b18bd8b45c586561bcbb99570437087debba95 100644 (file)
 
        ]
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index a7dfa62dae4ee207dd0fac0fc3aaab89d530e9e0..b291c5975e2955b9aaeb7bbef3b3c5528baa956c 100644 (file)
   {
       "pools": [ { "pool": "192.0.4.1 - 192.0.4.254" } ],
       "subnet": "192.0.4.0/24"
-  } ]
-},
+  } ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index 7d626b5eac3b4a695770d1fe5d5b82dd7199a1ab..a71014b8566bc761dd053d4b551803be9cc06a02 100644 (file)
        "subnet": "192.0.2.0/24",
        "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout. Alternatively, you can specify stderr here, a filename
 // or 'syslog', which will store output messages via syslog.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index b019d3f5279e8c8ba1d943a0e22ef95adcf54686..a5bd324570e6d2e83079cdc2f34115d51650915d 100644 (file)
         "qualifying-suffix" : "test.suffix.",
         "hostname-char-set": "[^A-Za-z0-9.-]",
         "hostname-char-replacement": "x"
-    }
-},
+    },
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp4",
index f64572a3f6d5356f059582f7f522c9abaacb1fbb..b1746bc1958b6ff57b4ebacc7e58c3cb5828c6ef 100644 (file)
             "ip-address": "3000::1"
         }
     }
-    ]
-},
+    ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 8bf956df169788b4b0bbda62a948185161890ec7..fb2cfe0b7a1e6ed59ad87511fc49373d9a818da9 100644 (file)
         "t1-percent": .5,
 
         // T2 = valid lifetime * .75.
-        "t2-percent": .75
-    },
-
-    // Logging configuration begins here.
-    "Logging": {
+        "t2-percent": .75,
 
         // List of loggers used by the servers using this configuration file.
         "loggers": [
index 09737b5a892eedcec51733399ba49bc8d880a26f..a6a488d4d0a75746eb95226a3ee99d6b95a7ceac 100644 (file)
 
             // Queue type was mandatory.
             "queue-type": "kea-ring6"
-        }
-    },
-
-    // Logging configuration begins here.
-    "Logging": {
+        },
 
         // List of loggers used by the servers using this configuration file.
         "loggers": [
index 87009690d7bbd08527f7b684ff10c3f9bdffd041..d03ba2f953d9370435048a156267222a3479d6a8 100644 (file)
       "subnet": "2001:db8:1::/64",
       "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 6cf7ae03e1981b47e5b2ecd2f6c868de0e836236..f1bf18f9e10a7080082bbb620a359993ab114b15 100644 (file)
       "subnet": "2001:db8:1::/64",
       "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 50c78e1a06b6488dd1ffb1bfa572ba233ead79e7..47e1e37ee855d2bfde98dfdc699e83490367865f 100644 (file)
          "interface": "ethY"
     }
 
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 997dad3ad26f9bd7de3bc2e05fc64f6416a26534..be3a071afdf7427f7f02b7d687c5178c1f37e2ea 100644 (file)
         ]
     }
 
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 4bd6f767debd75cf2e77535f8b05db521d73b4b1..b00891f528d185a1ae20b8ec8efe9ca540e665c1 100644 (file)
    "dhcp-ddns": {
        "comment": "No dynamic DNS",
        "enable-updates": false
-   }
-},
+   },
 
-"Logging": {
    // In loggers
    "loggers": [ {
        "comment": "A logger",
index 2acb41df8f6962055f2bee1d51988a5b8b582ff3..c2e6ad3dfbb31f11f0e26aed3a7292c142d7372b 100644 (file)
       "csv-format": true,
 // Put the server address here
       "data": "2001:db8:1:1::1" }
-   ]
-},
+   ],
 
-"Logging":
-{
-  "loggers": [
+   "loggers": [
     {
       "name": "kea-dhcp6",
       "output_options": [
index 653ad9281ef8157c64ee30074ef9ad78f399c52b..a192507ddc6860cd0ed1afdcd1e16b33a6713f6f 100644 (file)
       "subnet": "2001:db8:1::/64",
       "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at least
 // informational level (info, warn, error) will will be logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 5f6118ea5758d3c63a851c88b60011fffbb4fd24..b5674178c16125b60dc89bc486f919aa588a0b48 100644 (file)
             ],
             "interface": "ethX"
         }
-    ]
-},
+    ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 18ac41c957cd2e60e0279e244f39a8bdda75b6f8..5556aa903cb34553551757ebf9bd8c6544c92d32 100644 (file)
 
              "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout. Alternatively, you can specify stderr here, a filename
 // or 'syslog', which will store output messages via syslog.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index ff2e5fa528e2aff1b53c0fd7700a92b757995d91..6a1ae5869beb3e0b731755a56bfa63ef1723318f 100644 (file)
       "subnet": "2001:db8:1::/64",
       "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 6fab01c443c31bb85621a7c4a570c9f90e5a1d9d..ba20a630424310eadea287e6affa7384d027b837 100644 (file)
       "subnet": "2001:db8:1::/64",
       "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index f400c43a69f41e821dca4286c0afdc1302e2d228..0bd4968b5862521a13f0a12b285a7e6e9fb17f17 100644 (file)
       "interface": "ethX",
       "id": 1
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 6f930753df425c823e7dcea35bb77e59500df464..eef6f70cbc3ba8dfacc37aea603d3eb0b8158a47 100644 (file)
       "interface": "ethX",
       "id": 1
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 59e5e97eecfcbf1a18cd255d3819e8199a1c14b2..dad59d4f1e4e2d1057510ab8a3735cb11415767f 100644 (file)
 
       ]
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 54acb74f107ff84ccc12df1aa27e2169362161b9..bbebe365e4e5c6da243066a3f4b2fdd3fbec16cf 100644 (file)
   {    "pools": [ { "pool": "2001:db8:3::/80" } ],
        "subnet": "2001:db8:3::/64"  },
   {    "pools": [ { "pool": "2001:db8:4::/80" } ],
-       "subnet": "2001:db8:4::/64"  } ]
-},
+       "subnet": "2001:db8:4::/64"  } ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
-    "loggers": [
+  "loggers": [
         {
             "name": "kea-dhcp6",
             "output_options": [
index b47ca60f83b5b2b85030aabac10d3c68672dacac..30903b52dcf220174256d470f659b8e1255cb59a 100644 (file)
       "subnet": "2001:db8:1::/64",
       "interface": "ethX"
     }
-  ]
-},
+  ],
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout. Alternatively, you can specify stderr here, a filename
 // or 'syslog', which will store output messages via syslog.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 02e69455ce261c0ce3b97953cf35086dc99ec095..a5750693d49bca25eeb03124aa5ce1fd73d42014 100644 (file)
         }
       ]
     }
-  ]
-},
+  ],
 
 // The following configures logging. Kea will log all debug messages
 // to /var/log/kea-debug.log file.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 04cde9edccba7fd1f23337c92ab996cad5b37e5f..dc5232381659dba2bcaa795f6447de864acf2ebc 100644 (file)
         "qualifying-suffix" : "test.suffix.",
         "hostname-char-set": "[^A-Za-z0-9.-]",
         "hostname-char-replacement": "x"
-  }
+  },
 
-},
 
 // The following configures logging. It assumes that messages with at
 // least informational level (info, warn, error and fatal) should be
 // logged to stdout.
-"Logging": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 637996dd2937f6860fd2198da040e95d7df95b00..7f04e8d3acda5b10d3fbf8169bc9670ad4928075 100644 (file)
                     "socket-name": "/path/to/the/unix/socket-v4"
                 }
             }
-        }
+        },
 
-    },
-
-    "Logging":
-    {
         // In loggers
         "loggers": [
             {
index f5fdca8c2a8ffa68aadd114354eae05aaade46aa..8c918065dba8fb63b9fd68fd6aa01a63cb39f3a5 100644 (file)
                     "socket-name": "/tmp/kea6-sock"
                 }
             }
-        }
-    },
-    "Logging":
-    {
+        },
+
         "loggers":
         [
             {
index 42f06214ce3287fe07745094435a07b111d64ea4..b8f85e054fbaedd150fcd8222e9e8469a93db20e 100644 (file)
@@ -64,7 +64,7 @@
                 "comment": "Kea DHCP4 server serving network on floor 13"
             }
 
-        }
+        },
 
         // Netconf is able to load hook libraries that augment its operation.
         // The primary functionality is the ability to add new commands.
         //    }
         //]
 
-    },
-
-    // Similar to other Kea components, Netconf also uses logging.
-    "Logging":
-    {
+        // Similar to other Kea components, Netconf also uses logging.
         "loggers": [
             {
                 "name": "kea-netconf",
index 9ff8674412261b7c87dcbbab734ef3c564f5c155..5dbb22218eb32817a1e42430c55379999b41e121 100644 (file)
@@ -65,7 +65,7 @@
                 "comment": "Kea DHCP6 server serving network on floor 13"
             }
 
-        }
+        },
 
         // Netconf is able to load hook libraries that augment its operation.
         // The primary functionality is the ability to add new commands.
         //    }
         //]
 
-    },
-
-    // Similar to other Kea components, Netconf also uses logging.
-    "Logging":
-    {
+        // Similar to other Kea components, Netconf also uses logging.
         "loggers": [
             {
                 "name": "kea-netconf",
index 63da66af44d461d84b3954c4915b1df275fe20ae..347f0b440b22566021b4e4b513ac732788112ce1 100644 (file)
@@ -1,5 +1,5 @@
 <!--
- - Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
  -
  - This Source Code Form is subject to the terms of the Mozilla Public
  - License, v. 2.0. If a copy of the MPL was not distributed with this
             "parameters": {
                 "param1": "foo"
             }
-        } ]
-    },
+        } ],
 
-    "Logging": {
         "loggers": [ {
             "name": "kea-ctrl-agent",
             "severity": "INFO"
index f030825b6bfb14d52bfe0423bdc4ca142a9bac58..b2512965740f24bd66719532842d7dd016e231f3 100644 (file)
@@ -959,8 +959,6 @@ Result is an integer representation of the status. Currently supported statuses
     "command": "config-set",
     "arguments":  {
         "&lt;server&gt;": {
-        },
-        "Logging": {
         }
      }
 }</screen>
@@ -1000,8 +998,6 @@ Result is an integer representation of the status. Currently supported statuses
     "command": "config-test",
     "arguments":  {
         "&lt;server&gt;": {
-        },
-        "Logging": {
         }
      }
 }</screen>
index 2c7f2d2e0a18a35ad2cbfca5e0a657b1672fa696..f391154c6d515ad8c958b1a0c37c8bbab54548d5 100644 (file)
@@ -1,5 +1,5 @@
 <!--
- - Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
  -
  - This Source Code Form is subject to the terms of the Mozilla Public
  - License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -65,8 +65,8 @@
 
       <para>The configuration file consists of a single object (often
       colloquially called a map) started with a curly bracket. It
-      comprises one or more of the "Dhcp4", "Dhcp6", "DhcpDdns", "Control-agent",
-      "Netconf", and "Logging" objects. It is possible to define
+      comprises one or more of the "Dhcp4", "Dhcp6", "DhcpDdns",
+      "Control-agent" and "Netconf" objects. It is possible to define
       additional elements but they will be ignored.</para>
 
       <para>A very simple configuration for DHCPv4 could look like this:
         "subnet4": [{
            "pools": [ { "pool": "192.0.2.1-192.0.2.200" } ],
            "subnet": "192.0.2.0/24"
-        }]
-    },
+        }],
 
-    # Logger configuration starts here.
-    "Logging": {
+       # Now loggers are inside the DHCPv4 object.
        "loggers": [{
             "name": "*",
             "severity": "DEBUG"
 
       <note>
         <para>
-          The "Logging" element will be removed in Kea 1.6.0 and its contents
+          The "Logging" element is removed in Kea 1.6.0 and its contents
           (the "loggers" object) moved inside the configuration objects (maps) for
-          the respective Kea modules. For example, the "Dhcp4" map will contain the
+          respective Kea modules.  For example: the "Dhcp4" map contains the
           "loggers" object specifying logging configuration for the DHCPv4
-          server. Backward compatibility will be maintained until at least Kea
-          1.7.0; it will be possible to specify the "Logging" object
+          server. Backward compatibility is maintained until at least Kea
+          1.7.0 release: it will be possible to specify "Logging" object
           at the top configuration level and "loggers"
           objects at the module configuration level. Ultimately, support for the
           top-level "Logging" object will be removed.
index 9a408a3c517db6d3874da94c55cb7294395637f5..9526c1be5598ebc9424f95410eff98360187d812 100644 (file)
@@ -340,8 +340,6 @@ $ curl -X POST -H "Content-Type: application/json" -d '{ "command": "config-get"
     "command": "config-test",
     "arguments":  {
         "&lt;server&gt;": {
-        },
-        "Logging": {
         }
      }
 }
@@ -356,9 +354,6 @@ $ curl -X POST -H "Content-Type: application/json" -d '{ "command": "config-get"
     "arguments":  {
         "Dhcp6": {
             :
-        },
-        "Logging": {
-            :
         }
      }
 }
@@ -487,8 +482,6 @@ $ curl -X POST -H "Content-Type: application/json" -d '{ "command": "config-get"
     "command": "config-set",
     "arguments":  {
         "&lt;server&gt;": {
-        },
-        "Logging": {
         }
      }
 }
@@ -503,9 +496,6 @@ $ curl -X POST -H "Content-Type: application/json" -d '{ "command": "config-get"
     "arguments":  {
         "Dhcp6": {
             :
-        },
-        "Logging": {
-            :
         }
      }
 }
index 5b6b2b0e9d2ebaea979904fa11400fc5c21dd4cb..e52fe9a6c1dc63c43395ef01dcf890f5d7cc72a5 100644 (file)
@@ -193,10 +193,12 @@ In the example above this object is called <command>Dhcp4</command>.
 <note>
   <para>In the current Kea release it is possible to specify configurations
   of multiple modules within a single configuration file, but this is not
-  recommended. The
-  only object, besides the one specifying module configuration, which can be
-  (and usually is) included in the same file, is the <command>Logging</command> object.
-  However, we don't include this one in the example above for clarity.
+  recommended and support for it will be removed in the future releases. The
+  only object, besides the one specifying module configuration, which can
+  (and usually was) included in the same file is <command>Logging</command>.
+  However, we don't include this object in the example above for clarity
+  and its content, the list of loggers, should now be inside the
+  <command>Dhcp4</command> object instead of the deprecated object.
   </para>
 </note>
 
@@ -303,10 +305,8 @@ In some cases it may be preferable to use more compact notation.
 </para>
 
 <para>After all the parameters have been specified, we have two contexts open:
-global and Dhcp4, so we need two closing curly brackets to close them.
-In a real-life configuration file there most likely would be an additional
-component defined such as Logging, so the first closing brace would be followed
-by a comma and another object definition.</para>
+global and Dhcp4, hence we need two closing curly brackets to close them.
+</para>
 </section>
 
 <section>
@@ -3559,11 +3559,8 @@ It is merely echoed by the server.
         "pools": [ { "pool": "10.10.10.100 - 10.10.10.199" } ]
     } ],
 
-    <userinput>"dhcp4o6-port": 6767</userinput>
-
-},
+    <userinput>"dhcp4o6-port": 6767,</userinput>
 
-"Logging": {
     "loggers": [ {
         "name": "kea-dhcp4",
         "output_options": [ {
index 95ecbfcb294ffb9650dafabd1b9f1d98582305dc..ec0610dabfa6866be816e4c815347c138ebe2a72 100644 (file)
@@ -194,10 +194,12 @@ In the example above this object is called <command>Dhcp6</command>.
 <note>
   <para>In the current Kea release it is possible to specify configurations
   of multiple modules within a single configuration file, but this is not
-  recommended. The
-  only object, besides the one specifying module configuration, which can be
-  (and usually is) included in the same file, is the <command>Logging</command> object.
-  However, we don't include this object in the example above for clarity.
+  recommended and support for it will be removed in the future releases. The
+  only object, besides the one specifying module configuration, which can
+  (and usually was) included in the same file is <command>Logging</command>.
+  However, we don't include this object in the example above for clarity
+  and its content, the list of loggers, should now be inside the
+  <command>Dhcp4</command> object instead of this deprecated object.
   </para>
 </note>
 
@@ -292,10 +294,8 @@ In some cases in may be preferable to use more compact notation.
 </para>
 
 <para>After all parameters are specified, we have two contexts open:
-global and Dhcp6, so we need two closing curly brackets to close them.
-In a real-life configuration file there most likely would be additional
-components defined such as Logging, so the first closing brace would be followed
-by a comma and another object definition.</para>
+global and Dhcp6, hence we need two closing curly brackets to close them.
+</para>
 </section>
 
 <section>
@@ -3107,11 +3107,9 @@ should include options from the new option space:
         "space": "dhcp6",
         "csv-format": true,
         "data": "2001:db8:1:1::1"
-    } ]
+    } ],
 </userinput>
-},
 
-"Logging": {
     "loggers": [ {
         "name": "kea-dhcp6",
         "output_options": [ {
index d5edef211610638ab468d69b866f7132300de82c..f6e2f92d7f9bb8a36d54c41a37ccc184b4697b7e 100644 (file)
@@ -1,5 +1,5 @@
 <!--
- - Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
  -
  - This Source Code Form is subject to the terms of the Mozilla Public
  - License, v. 2.0. If a copy of the MPL was not distributed with this
     </para>
 
     <para>
-      The logging system in Kea is configured through the
-      Logging section in your configuration
-      file. All daemons (e.g. DHCPv4 and DHCPv6 servers) will use the
-      configuration in the Logging section to see
-      what should be logged and to where. This allows for sharing identical
-      logging configuration between daemons.
+      The logging system in Kea is configured through the loggers entry
+      in the server section of your configuration file. In previous
+      Kea releases this entry was in an independent Logging section,
+      this is still supported for backward compatibility.
     </para>
 
     <section>
@@ -61,7 +59,7 @@
       </para>
 
       <para>
-        In the Logging section of a configuration file you can specify the
+        In the server section of a configuration file you can specify the
         configuration for zero or more loggers (including loggers used by the
         proprietary hooks libraries). If there are no loggers specified, the
         code will use default values; these cause Kea to log messages of INFO
           configuration.
         </para>
 
-        <!-- we don't support asterisk anymore.
-        <para>
-          One special case is that of a component name of <quote>*</quote>
-          (asterisks), which is interpreted as <emphasis>any</emphasis>
-          component. You can set global logging options by using this,
-          including setting the logging configuration for a library
-          that is used by multiple daemons (e.g. <quote>*.config</quote>
-          specifies the configuration library code in whatever
-          daemon is using it).
-        </para> -->
-
         <para>
           If there are multiple logger specifications in the configuration
           that might match a particular logger, the specification with the
                 <row><entry><command>kea-dhcp-ddns.dhcpddns</command></entry><entry>core</entry><entry>The logger used by the kea-dhcp-ddns daemon for logging events related to DDNS operations.</entry></row>
                 <row><entry><command>kea-dhcp-ddns.dhcp-to-d2</command></entry><entry>core</entry><entry>Used by the kea-dhcp-ddns daemon for logging information about events dealing with receiving messages from the DHCP servers and adding them to the queue for processing.</entry></row>
                 <row><entry><command>kea-dhcp-ddns.d2-to-dns</command></entry><entry>core</entry><entry>Used by the kea-dhcp-ddns daemon for logging information about events dealing with sending and receiving messages with the DNS servers.</entry></row>
+                <row><entry><command>kea-netconf</command></entry><entry>core</entry><entry>The root logger for the Netconf agent. All components used by Netconf inherit the settings from this logger if there is no specialized logger provided.</entry></row>
               </tbody>
             </tgroup>
           </table>
       <section>
         <title>Example Logger Configurations</title>
         <para>
-          In this example we want to set the global logging to write to the
+          In this example we want to set the Server logging to write to the
           console using standard output.
         </para>
 
-<screen><userinput>"Logging": {
+<screen><userinput>"Server": {
     "loggers": [
         {
             "name": "kea-dhcp4",
           created.
         </para>
 
-<screen><userinput>"Logging": {
+<screen><userinput>"Server": {
     "loggers": [
         {
             "name": "kea-dhcp6",
index 85f4a6a11f475bd66ab4c9e284f478169d66b260..0bd63a599c490b96f84414569c584ba60f2b71ac 100644 (file)
@@ -1,5 +1,5 @@
 <!--
- - Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
  -
  - This Source Code Form is subject to the terms of the Mozilla Public
  - License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -619,13 +619,9 @@ done in dependency order and reverse dependency order accordingly.
                     "param1": "foo"
                 }
             }
-        ]
-
-    },
+        ],
 
-    // Similar to other Kea components, kea-netconf also uses logging.
-    "Logging":
-    {
+        // Similar to other Kea components, Netconf also uses logging.
         "loggers": [
             {
                 "name": "kea-netconf",
@@ -794,10 +790,8 @@ done in dependency order and reverse dependency order accordingly.
                     "socket-name": "/tmp/kea6-sock"
                 }
             }
-        }
-    },
-    "Logging":
-    {
+        },
+
         "loggers":
         [
             {
@@ -1077,7 +1071,7 @@ done in dependency order and reverse dependency order accordingly.
     <section xml:id="operation-example-logging">
       <title>NETCONF Operation Example with Logging</title>
       <para>
-        This example adds a Logging section to the initial (i.e. startup)
+        This example adds a logger entry to the initial (i.e. startup)
         configuration in the <filename>logging.xml</filename> file:
 <screen>
 &lt;config xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp6-server"&gt;
@@ -1131,9 +1125,7 @@ done in dependency order and reverse dependency order accordingly.
         ],
         "subnet": "2001:db8::/64"
       }
-    ]
-  },
-  "Logging": {
+    ],
     "loggers": [
       {
         "name": "kea-dhcp6",
index 20c193bd10f531a722ea4ea0e5219d9241310dfe..5bf87e5e94e8aa08f42b9ea49610b6242ba51a35 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -145,7 +145,7 @@ CtrlAgentCfgContext::getControlSocketInfoSummary() const {
 
 ElementPtr
 CtrlAgentCfgContext::toElement() const {
-    ElementPtr ca = Element::createMap();
+    ElementPtr ca = ConfigBase::toElement();
     // Set user-context
     contextToElement(ca);
     // Set http-host
@@ -165,8 +165,6 @@ CtrlAgentCfgContext::toElement() const {
     ElementPtr result = Element::createMap();
     result->set("Control-agent", ca);
 
-    // Set Logging (not yet)
-
     return (result);
 }
 
index 2fbc0d272b672a55e4ff035ae206e11ae2d80b6a..c7271a89ea58a956b9c757de9ae0f55ef6abe7e9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -173,10 +173,10 @@ public:
         ///< Used while parsing Control-agent/hooks-libraries.
         HOOKS_LIBRARIES,
 
-        ///< Used while parsing Logging/loggers structures.
+        ///< Used while parsing Control-agent/loggers structures.
         LOGGERS,
 
-        ///< Used while parsing Logging/loggers/output_options structures.
+        ///< Used while parsing Control-agent/loggers/output_options structures.
         OUTPUT_OPTIONS
 
     } LexerContext;
index a79a839d08bedf93b6d6003faf8f80fe4b7a1d72..2f248004d385817a555fd6325ca710142efd5cb7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -60,7 +60,7 @@ D2CfgContext::~D2CfgContext() {
 
 ElementPtr
 D2CfgContext::toElement() const {
-    ElementPtr d2 = Element::createMap();
+    ElementPtr d2 = ConfigBase::toElement();
     // Set user-context
     contextToElement(d2);
     // Set ip-address
index 682043ba4f60b2b0f6fb0f7f1170b10cbd013725..179862ea84f635bab7eb8d43a1b88e63d2143aa2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -210,10 +210,10 @@ public:
         ///< Used while parsing content of Logging
         LOGGING,
 
-        /// Used while parsing Logging/loggers structures.
+        /// Used while parsing DhcpDdns/loggers structures.
         LOGGERS,
 
-        /// Used while parsing Logging/loggers/output_options structures.
+        /// Used while parsing DhcpDdns/loggers/output_options structures.
         OUTPUT_OPTIONS,
 
         /// Used while parsing DhcpDdns/ncr-protocol
index 0595c1ad01e68e1e3866322401fdca97614e095d..8fa7b20db4e82215e9dabdbd08902b000fd10cdd 100644 (file)
@@ -304,9 +304,8 @@ ControlledDhcpv4Srv::commandConfigSetHandler(const string&,
     string message;
 
     // Command arguments are expected to be:
-    // { "Dhcp4": { ... }, "Logging": { ... } }
-    // The Logging component is technically optional. If it's not supplied
-    // logging will revert to default logging.
+    // { "Dhcp4": { ... } }
+    // The Logging component is supported by backward compatiblity.
     if (!args) {
         message = "Missing mandatory 'arguments' parameter.";
     } else {
@@ -330,19 +329,27 @@ ControlledDhcpv4Srv::commandConfigSetHandler(const string&,
     // configuration attempts.
     CfgMgr::instance().rollback();
 
-    // Logging is a sibling element and must be parsed explicitly.
-    // The call to configureLogger parses the given Logging element if
-    // not null, into the staging config.  Note this does not alter the
-    // current loggers, they remain in effect until we apply the
-    // logging config below.  If no logging is supplied logging will
-    // revert to default logging.
-    Daemon::configureLogger(args->get("Logging"),
-                            CfgMgr::instance().getStagingCfg());
+    // Check obsolete objects.
+
+    // Check deprecated objects.
+
+    // Relocate Logging.
+    Daemon::relocateLogging(args, "Dhcp4");
+
+    // Parse the logger configuration explicitly into the staging config.
+    // Note this does not alter the current loggers, they remain in
+    // effect until we apply the logging config below.  If no logging
+    // is supplied logging will revert to default logging.
+    Daemon::configureLogger(dhcp4, CfgMgr::instance().getStagingCfg());
 
     // Let's apply the new logging. We do it early, so we'll be able to print
     // out what exactly is wrong with the new socnfig in case of problems.
     CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
 
+    // Log deprecated objects.
+
+    // Log obsolete objects and return an error.
+
     // Now we configure the server proper.
     ConstElementPtr result = processConfig(dhcp4);
 
@@ -374,9 +381,8 @@ ControlledDhcpv4Srv::commandConfigTestHandler(const string&,
     string message;
 
     // Command arguments are expected to be:
-    // { "Dhcp4": { ... }, "Logging": { ... } }
-    // The Logging component is technically optional. If it's not supplied
-    // logging will revert to default logging.
+    // { "Dhcp4": { ... } }
+    // The Logging component is supported by backward compatiblity.
     if (!args) {
         message = "Missing mandatory 'arguments' parameter.";
     } else {
@@ -400,6 +406,13 @@ ControlledDhcpv4Srv::commandConfigTestHandler(const string&,
     // configuration attempts.
     CfgMgr::instance().rollback();
 
+    // Check obsolete objects.
+
+    // Relocate Logging. Note this allows to check the loggers configuration.
+    Daemon::relocateLogging(args, "Dhcp4");
+
+    // Log obsolete objects and return an error.
+
     // Now we check the server proper.
     return (checkConfig(dhcp4));
 }
index c3120af2402e018e1539972f86f1146b4ca9c7e7..0b2a471fac03182ca63b16eb52541abdc0be7379 100644 (file)
@@ -205,7 +205,8 @@ private:
     /// @param command (parameter ignored)
     /// @param args configuration to be processed. Expected format:
     /// map containing Dhcp4 map that contains DHCPv4 server configuration.
-    /// May also contain Logging map that specifies logging configuration.
+    /// May also contain Logging map that specifies logging configuration
+    /// for backward compatibility.
     ///
     /// @return status of the command
     isc::data::ConstElementPtr
@@ -219,7 +220,8 @@ private:
     /// @param command (parameter ignored)
     /// @param args configuration to be checked. Expected format:
     /// map containing Dhcp4 map that contains DHCPv4 server configuration.
-    /// May also contain Logging map that specifies logging configuration.
+    /// May also contain Logging map that specifies logging configuration
+    /// for backward compatibility.
     ///
     /// @return status of the command
     isc::data::ConstElementPtr
index 4d0bd3a0a8ee504359ab049196620542c5feb380..b3f58c2b2f3dbdae12ec68b08864db685e4ccc75 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2012-2019 Internet Systems Consortium, Inc. ("ISC")
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -134,6 +134,14 @@ new configuration. It is output during server startup, and when an updated
 configuration is committed by the administrator.  Additional information
 may be provided.
 
+% DHCP4_CONFIG_DEPRECATED DHCPv4 server configuration includes a deprecated object: %1
+This warning message is issued when the configuration includes a deprecated
+object (i.e. a top level element) which will be ignored.
+
+% DHCP4_CONFIG_FETCH Fetching configuration data from config backends.
+This is an informational message emitted when the DHCPv4 server about to begin
+retrieving configuration data from one or more configuration backends.
+
 % DHCP4_CONFIG_LOAD_FAIL configuration error using file: %1, reason: %2
 This error message indicates that the DHCPv4 configuration has failed.
 If this is an initial configuration (during server's startup) the server
@@ -144,6 +152,10 @@ server will continue to use an old configuration.
 This is an informational message reporting that the configuration has
 been extended to include the specified IPv4 subnet.
 
+% DHCP4_CONFIG_OBSOLETE DHCPv4 server configuration includes an obsolete object: %1
+This error message is issued when the configuration includes an obsolete
+object (i.e. a top level element).
+
 % DHCP4_CONFIG_OPTION_DUPLICATE multiple options with the code %1 added to the subnet %2
 This warning message is issued on an attempt to configure multiple options
 with the same option code for a particular subnet. Adding multiple options
index 51b08d7272718dc7389805328b37529838eb7862..227e2a2274046c53e495ff40dc26456d8fce4523 100644 (file)
@@ -556,7 +556,8 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
                  (config_pair.first == "reservation-mode") ||
                  (config_pair.first == "calculate-tee-times") ||
                  (config_pair.first == "t1-percent") ||
-                 (config_pair.first == "t2-percent")) {
+                 (config_pair.first == "t2-percent") ||
+                 (config_pair.first == "loggers")) {
 
                 CfgMgr::instance().getStagingCfg()->addConfiguredGlobal(config_pair.first,
                                                                         config_pair.second);
index ae95f02c072fc2f376a678f06a8ed02414f0ccd8..a36b311d1ed011ab130ce3025ee059aa999e905f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -282,10 +282,10 @@ public:
         /// Used while parsing Dhcp4/subnet4relay structures.
         RELAY,
 
-        /// Used while parsing Logging/loggers structures.
+        /// Used while parsing Dhcp4/loggers structures.
         LOGGERS,
 
-        /// Used while parsing Logging/loggers/output_options structures.
+        /// Used while parsing Dhcp4/loggers/output_options structures.
         OUTPUT_OPTIONS,
 
         /// Used while parsing Dhcp4/dhcp-ddns.
index c76c82af9833a0b3b17c7dac0b1b0ab12f00e239..7fd7de4cddd54bd729c3a816064760062e8aed26 100644 (file)
@@ -306,9 +306,8 @@ ControlledDhcpv6Srv::commandConfigSetHandler(const string&,
     string message;
 
     // Command arguments are expected to be:
-    // { "Dhcp6": { ... }, "Logging": { ... } }
-    // The Logging component is technically optional. If it's not supplied
-    // logging will revert to default logging.
+    // { "Dhcp6": { ... } }
+    // The Logging component is supported by backward compatiblity.
     if (!args) {
         message = "Missing mandatory 'arguments' parameter.";
     } else {
@@ -332,19 +331,27 @@ ControlledDhcpv6Srv::commandConfigSetHandler(const string&,
     // configuration attempts.
     CfgMgr::instance().rollback();
 
-    // Logging is a sibling element and must be parsed explicitly.
-    // The call to configureLogger parses the given Logging element if
-    // not null, into the staging config.  Note this does not alter the
-    // current loggers, they remain in effect until we apply the
-    // logging config below.  If no logging is supplied logging will
-    // revert to default logging.
-    Daemon::configureLogger(args->get("Logging"),
-                            CfgMgr::instance().getStagingCfg());
+    // Check obsolete objects.
+
+    // Check deprecated objects.
+
+    // Relocate Logging.
+    Daemon::relocateLogging(args, "Dhcp6");
+
+    // Parse the logger configuration explicitly into the staging config.
+    // Note this does not alter the current loggers, they remain in
+    // effect until we apply the logging config below.  If no logging
+    // is supplied logging will revert to default logging.
+    Daemon::configureLogger(dhcp6, CfgMgr::instance().getStagingCfg());
 
     // Let's apply the new logging. We do it early, so we'll be able to print
     // out what exactly is wrong with the new socnfig in case of problems.
     CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
 
+    // Log deprecated objects.
+
+    // Log obsolete objects and return an error.
+
     // Now we configure the server proper.
     ConstElementPtr result = processConfig(dhcp6);
 
@@ -376,9 +383,8 @@ ControlledDhcpv6Srv::commandConfigTestHandler(const string&,
     string message;
 
     // Command arguments are expected to be:
-    // { "Dhcp6": { ... }, "Logging": { ... } }
-    // The Logging component is technically optional. If it's not supplied
-    // logging will revert to default logging.
+    // { "Dhcp6": { ... } }
+    // The Logging component is supported by backward compatiblity.
     if (!args) {
         message = "Missing mandatory 'arguments' parameter.";
     } else {
@@ -402,6 +408,13 @@ ControlledDhcpv6Srv::commandConfigTestHandler(const string&,
     // configuration attempts.
     CfgMgr::instance().rollback();
 
+    // Check obsolete objects.
+
+    // Relocate Logging. Note this allows to check the loggers configuration.
+    Daemon::relocateLogging(args, "Dhcp4");
+
+    // Log obsolete objects and return an error.
+
     // Now we check the server proper.
     return (checkConfig(dhcp6));
 }
index ef776c83a8d2fcd9eac0025059cd017c6e33ff40..c859115aa657e1a02d008f6e7da9fbdc00870118 100644 (file)
@@ -205,7 +205,8 @@ private:
     /// @param command (parameter ignored)
     /// @param args configuration to be processed. Expected format:
     /// map containing Dhcp6 map that contains DHCPv6 server configuration.
-    /// May also contain Logging map that specifies logging configuration.
+    /// May also contain Logging map that specifies logging configuration
+    /// for backward compatibility.
     ///
     /// @return status of the command
     isc::data::ConstElementPtr
@@ -219,7 +220,8 @@ private:
     /// @param command (parameter ignored)
     /// @param args configuration to be checked. Expected format:
     /// map containing Dhcp6 map that contains DHCPv6 server configuration.
-    /// May also contain Logging map that specifies logging configuration.
+    /// May also contain Logging map that specifies logging configuration
+    /// for backward compatibility.
     ///
     /// @return status of the command
     isc::data::ConstElementPtr
index 53bb696a7705275dc5afc0fef7f9f0d62591c27e..7328687f96d1baafacce2064342ffc7f8d4c2bb5 100644 (file)
@@ -98,12 +98,20 @@ new configuration. it is output during server startup, and when an updated
 configuration is committed by the administrator.  Additional information
 may be provided.
 
+% DHCP6_CONFIG_DEPRECATED DHCPv6 server configuration includes a deprecated object: %1
+This warning message is issued when the configuration includes a deprecated
+object (i.e. a top level element) which will be ignored.
+
 % DHCP6_CONFIG_LOAD_FAIL configuration error using file: %1, reason: %2
 This error message indicates that the DHCPv6 configuration has failed.
 If this is an initial configuration (during server's startup) the server
 will fail to start. If this is a dynamic reconfiguration attempt the
 server will continue to use an old configuration.
 
+% DHCP6_CONFIG_OBSOLETE DHCPv6 server configuration includes an obsolete object: %1
+This error message is issued when the configuration includes an obsolete
+object (i.e. a top level element).
+
 % DHCP6_CONFIG_PACKET_QUEUE DHCPv6 packet queue info after configuration: %1
 This informational message is emitted during DHCPv6 server configuration,
 immediately after configuring the DHCPv6 packet queue.  The information
index b495e41ed79637a6a218fd3ae4fe4e93eccc063d..a0068ecf8fe9f8e414b19e8de765717d3fdb08f5 100644 (file)
@@ -673,7 +673,8 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
                  (config_pair.first == "reservation-mode") ||
                  (config_pair.first == "calculate-tee-times") ||
                  (config_pair.first == "t1-percent") ||
-                 (config_pair.first == "t2-percent")) {
+                 (config_pair.first == "t2-percent") ||
+                 (config_pair.first == "loggers")) {
 
                 CfgMgr::instance().getStagingCfg()->addConfiguredGlobal(config_pair.first,
                                                                         config_pair.second);
index aea40cc28b7fc56e6aee3b616ad5c7d6099e58ba..513aa02daa419af8cf66a5dd6ea9c455f63404bb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -289,10 +289,10 @@ public:
         /// Used while parsing Dhcp6/subnet6/relay structures.
         RELAY,
 
-        /// Used while parsing Logging/loggers structures.
+        /// Used while parsing Dhcp6/loggers structures.
         LOGGERS,
 
-        /// Used while parsing Logging/loggers/output_options structures.
+        /// Used while parsing Dhcp6/loggers/output_options structures.
         OUTPUT_OPTIONS,
 
         /// Used while parsing Dhcp6/dhcp-ddns.
index 94177a7068a6035c7fad06902f94fd7d9aab5564..b887a90b8b7f2b20bdf58b4c8aa5f369d9c84d6b 100644 (file)
 //          "param1": "foo"
 //      }
 //  }
-    ]
-},
+    ],
 
 // Logging configuration starts here. Kea uses different loggers to log various
 // activities. For details (e.g. names of loggers), see Chapter 18.
-"Logging":
-{
-  "loggers": [
+    "loggers": [
     {
         // This specifies the logging for Control Agent daemon.
         "name": "kea-ctrl-agent",
index d56119f74c2ca54f56b8166e42d26f95305f2944..cc75cf1eb1fe28d32b9445e59a0300bf0d1b1954 100644 (file)
   },
   "tsig-keys": [],
   "forward-ddns" : {},
-  "reverse-ddns" : {}
-},
+  "reverse-ddns" : {},
 
 // Logging configuration starts here. Kea uses different loggers to log various
 // activities. For details (e.g. names of loggers), see Chapter 18.
-"Logging":
-{
   "loggers": [
     {
         // This specifies the logging for D2 (DHCP-DDNS) daemon.
index 126b9b4081bfa0448ea21a512c90019f0481179b..a2d78769629addf7b369e99151aaf65130360482 100644 (file)
     // There are many, many more parameters that DHCPv4 server is able to use.
     // They were not added here to not overwhelm people with too much
     // information at once.
-},
 
 // Logging configuration starts here. Kea uses different loggers to log various
 // activities. For details (e.g. names of loggers), see Chapter 18.
-"Logging":
-{
-  "loggers": [
+    "loggers": [
     {
         // This section affects kea-dhcp4, which is the base logger for DHCPv4
         // component. It tells DHCPv4 server to write all log messages (on
index 5b44143380db209f5c8a47de0cca0f2ad5c8b044..d3e50833789bd2dbe1c0f6bcbf95e4686ebd97df 100644 (file)
 
     // DDNS information (how the DHCPv6 component can reach a DDNS daemon)
 
-},
-
 // Logging configuration starts here. Kea uses different loggers to log various
 // activities. For details (e.g. names of loggers), see Chapter 18.
-"Logging":
-{
-  "loggers": [
+    "loggers": [
     {
         // This specifies the logging for kea-dhcp6 logger, i.e. all logs
         // generated by Kea DHCPv6 server.
index d445e8b15549320dc8ff1a5b2e311fc7f02f5152..f68e24fddd3607282d40a08074b592691cb8c542 100644 (file)
 //      }
 //  }
 //  ]
-},
 
 // Logging configuration starts here. Kea uses different loggers to log various
 // activities. For details (e.g. names of loggers), see Chapter 18.
-"Logging":
-{
-  "loggers": [
+    "loggers": [
     {
         // This specifies the logging for Netconf daemon.
         "name": "kea-netconf",
index 5cddc3a5c289542a32a1ffe3b194098b8aabed80..7208280723be5fc64fd2c4e0fa6dcb0cd28718b2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -144,7 +144,7 @@ NetconfCfgMgr::parse(isc::data::ConstElementPtr config_set,
 
 ElementPtr
 NetconfConfig::toElement() const {
-    ElementPtr netconf = Element::createMap();
+    ElementPtr netconf = ConfigBase::toElement();
     // Set user-context
     contextToElement(netconf);
     // Add in explicitly configured globals.
@@ -161,9 +161,6 @@ NetconfConfig::toElement() const {
     // Set Netconf
     ElementPtr result = Element::createMap();
     result->set("Netconf", netconf);
-
-    // Set Logging (not yet)
-
     return (result);
 }
 
index a75a89c477ed7926adbc31ab01ba26a9ddc17ad2..b83fc09ecb50b26fb2a18747cf647c317d8432ed 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -190,10 +190,10 @@ public:
         ///< Used while parsing Netconf/hooks-libraries.
         HOOKS_LIBRARIES,
 
-        ///< Used while parsing Logging/loggers structures.
+        ///< Used while parsing Netconf/loggers structures.
         LOGGERS,
 
-        ///< Used while parsing Logging/loggers/output_options structures.
+        ///< Used while parsing Netconf/loggers/output_options structures.
         OUTPUT_OPTIONS
 
     } LexerContext;
index a4d3b59a61d661f93c05ab3e714fd70a285f26da..3c2da71e927c8487ffb7ec312ba6e6a4e0bf236f 100644 (file)
@@ -295,12 +295,12 @@ SrvConfig::extractConfiguredGlobals(isc::data::ConstElementPtr config) {
 ElementPtr
 SrvConfig::toElement() const {
     // Toplevel map
-    ElementPtr result = ConfigBase::toElement();
+    ElementPtr result = Element::createMap();
 
     // Get family for the configuration manager
     uint16_t family = CfgMgr::instance().getFamily();
     // DhcpX global map
-    ElementPtr dhcp = Element::createMap();
+    ElementPtr dhcp = ConfigBase::toElement();
 
     // Add in explicitly configured globals.
     dhcp->setValue(configured_globals_->mapValue());
index 6e9ffd6e82f42bd095f419d93788ba330749e23e..378acd19c10d8796b05bf62cc4cb457b7f37e3f6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -111,9 +111,8 @@ ElementPtr
 ConfigBase::toElement() const {
     ElementPtr result = Element::createMap();
 
-    // Logging global map (skip if empty)
+    // Was in the Logging global map.
     if (!logging_info_.empty()) {
-        ElementPtr logging = Element::createMap();
         // Set loggers list
         ElementPtr loggers = Element::createList();
         for (LoggingInfoStorage::const_iterator logger =
@@ -121,8 +120,7 @@ ConfigBase::toElement() const {
              logger != logging_info_.cend(); ++logger) {
             loggers->add(logger->toElement());
         }
-        logging->set("loggers", loggers);
-        result->set("Logging", logging);
+        result->set("loggers", loggers);
     }
 
     // server-tag
@@ -130,6 +128,7 @@ ConfigBase::toElement() const {
         result->set("server-tag", Element::create(server_tag_.get()));
     }
 
+    // Note this comment below is obsolete...
     // We do NOT output ConfigControlInfo here, as it is not a
     // top level element, but rather belongs within the process
     // element.
index e1965b317c6bfe2c5deb7f2b0ec9c1155dd12e5a..32de6b3f4cba5708627d5f1f3fcbaeee516119db 100644 (file)
@@ -86,7 +86,7 @@ public:
     /// as JSON):
     /// {{{
     /// {
-    ///     "Logging": {
+    ///     "Server": {
     ///         :
     ///     }
     /// }
index a1c3597a98dec6d9c6ded39078f49222c6f3d0cd..234214cf589bbb2f48e4db7bb17c6c889b27b655 100644 (file)
@@ -186,6 +186,17 @@ DControllerBase::checkConfigOnly() {
             isc_throw(InvalidUsage, "Config file " << config_file <<
                       " does not include '" << getAppName() << "' entry");
         }
+        if (module_config->getType() != Element::map) {
+            isc_throw(InvalidUsage, "Config file " << config_file <<
+                      " include not map '" << getAppName() << "' entry");
+        }
+
+        // Check obsolete objects.
+
+        // Relocate Logging.
+        Daemon::relocateLogging(whole_config, getAppName());
+
+        // Log obsolete objects and return an error.
 
         // Get an application process object.
         initProcess();
@@ -345,6 +356,25 @@ DControllerBase::configFromFile() {
             whole_config = Element::fromJSONFile(config_file, true);
         }
 
+        // Extract derivation-specific portion of the configuration.
+        module_config = whole_config->get(getAppName());
+        if (!module_config) {
+            isc_throw(BadValue, "Config file " << config_file <<
+                                " does not include '" <<
+                                 getAppName() << "' entry.");
+        }
+        if (module_config->getType() != Element::map) {
+            isc_throw(InvalidUsage, "Config file " << config_file <<
+                      " include not map '" << getAppName() << "' entry");
+        }
+
+        // Check obsolete objects.
+
+        // Check deprecated objects.
+
+        // Relocate Logging.
+        Daemon::relocateLogging(whole_config, getAppName());
+
         // Let's configure logging before applying the configuration,
         // so we can log things during configuration process.
 
@@ -353,15 +383,11 @@ DControllerBase::configFromFile() {
 
         // Get 'Logging' element from the config and use it to set up
         // logging. If there's no such element, we'll just pass NULL.
-        Daemon::configureLogger(whole_config->get("Logging"), storage);
+        Daemon::configureLogger(module_config, storage);
 
-        // Extract derivation-specific portion of the configuration.
-        module_config = whole_config->get(getAppName());
-        if (!module_config) {
-            isc_throw(BadValue, "Config file " << config_file <<
-                                " does not include '" <<
-                                 getAppName() << "' entry.");
-        }
+        // Log deprecated objects.
+
+        // Log obsolete objects and return an error.
 
         answer = updateConfig(module_config);
         int rcode = 0;
index 79cf4f1ddeaa4517680f7efbc716f62843531df1..8f971a045187aca10ae1b30961aef3c66df3efeb 100644 (file)
@@ -186,9 +186,6 @@ public:
     ///
     /// @code
     ///  { "<module-name>": {<module-config>}
-    ///
-    ///   # Logging element is optional
-    ///   ,"Logging": {<logger config}
     ///  }
     ///
     ///  where:
@@ -204,12 +201,11 @@ public:
     /// file content using an alternate parser.  If it returns an empty pointer
     /// than the JSON parsing providing by Element::fromJSONFile() is called.
     ///
-    /// Once parsed, the method looks for the Element "Logging" and, if present
-    /// uses it to configure logging.
-    ///
-    /// It then extracts the set of configuration elements for the
-    /// module-name that matches the controller's app_name_ and passes that
-    /// set into @c updateConfig() (or @c checkConfig()).
+    /// Once parsed, the method extracts the set of configuration
+    /// elements for the module-name that matches the controller's app_name_,
+    /// looks for the loggers entry and, if present uses it to configure
+    /// logging. It then passes that set into @c updateConfig() (or
+    /// @c checkConfig()).
     ///
     /// The file may contain an arbitrary number of other modules.
     ///
index 4cd280d2c81d37ab2c9d5d59fbc12a58db2186ec..273119d66cae14d3d64962d507d576c672b5d908 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -20,6 +20,8 @@
 #include <fstream>
 #include <errno.h>
 
+using namespace isc::data;
+
 /// @brief provides default implementation for basic daemon operations
 ///
 /// This file provides stub implementations that are expected to be redefined
@@ -63,11 +65,36 @@ void Daemon::handleSignal() {
     }
 }
 
-void Daemon::configureLogger(const isc::data::ConstElementPtr& log_config,
+void Daemon::relocateLogging(ConstElementPtr config,
+                             const std::string server_name) {
+    ConstElementPtr logging = config->get("Logging");
+    ConstElementPtr loggers;
+    if (logging) {
+        loggers = logging->get("loggers");
+        ElementPtr mutable_cfg = boost::const_pointer_cast<Element>(config);
+        mutable_cfg->remove("Logging");
+    }
+    if (loggers) {
+        ConstElementPtr server = config->get(server_name);
+        ElementPtr mutable_srv = boost::const_pointer_cast<Element>(server);
+        mutable_srv->set("loggers", loggers);
+    }
+    while (config->size() > 1) {
+        ElementPtr mutable_cfg = boost::const_pointer_cast<Element>(config);
+        for (auto object : config->mapValue()) {
+            if (object.first != server_name) {
+                mutable_cfg->remove(object.first);
+                break;
+            }
+        }
+    }
+}
+
+void Daemon::configureLogger(const ConstElementPtr& log_config,
                              const ConfigPtr& storage) {
 
     if (log_config) {
-        isc::data::ConstElementPtr loggers = log_config->get("loggers");
+        ConstElementPtr loggers = log_config->get("loggers");
         if (loggers) {
             LogConfigParser parser(storage);
             parser.parseConfiguration(loggers, verbose_);
@@ -227,7 +254,7 @@ Daemon::createPIDFile(int pid) {
 
 size_t
 Daemon::writeConfigFile(const std::string& config_file,
-                        isc::data::ConstElementPtr cfg) const {
+                        ConstElementPtr cfg) const {
     if (!cfg) {
         isc_throw(Unexpected, "Can't write configuration: conversion to JSON failed");
     }
@@ -238,7 +265,7 @@ Daemon::writeConfigFile(const std::string& config_file,
     }
 
     // Write the actual content using pretty printing.
-    isc::data::prettyPrint(cfg, out);
+    prettyPrint(cfg, out);
 
     size_t bytes = static_cast<size_t>(out.tellp());
 
index d779464814d850e237967b3c4736412334f01a2e..7ef812d952ba1eade8d598423f2b0120fac26b11 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -85,9 +85,21 @@ public:
     /// @param verbose verbose mode (true usually enables DEBUG messages)
     static void loggerInit(const char* log_name, bool verbose);
 
+    /// @brief Relocate Logging configuration
+    ///
+    /// Moves the loggers entry from Logging to the server top element.
+    /// This method assumes the configuration is sane, e.g. the server
+    /// top element exists and is a map.
+    /// Top elements other than the server one are removed.
+    ///
+    /// @param config JSON top level configuration
+    /// @param server_name name of the server top element
+    static void relocateLogging(isc::data::ConstElementPtr config,
+                                const std::string server_name);
+
     /// @brief Configures logger
     ///
-    /// Applies configuration stored in "Logging" structure in the
+    /// Applies configuration stored in a top-level structure in the
     /// configuration file. This structure has a "loggers" array that
     /// contains 0 or more entries, each configuring one logging source
     /// (name, severity, debuglevel), each with zero or more outputs (file,
index daf2653f17aaff706e3f4f091fe613784372882b..dd3203a8fb7fd957baf51c4550d983617d848f12 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -32,7 +32,7 @@ void LogConfigParser::parseConfiguration(const isc::data::ConstElementPtr& logge
                                          bool verbose) {
     verbose_ = verbose;
 
-    // Iterate over all entries in "Logging/loggers" list
+    // Iterate over all entries in "Server/loggers" list
     BOOST_FOREACH(ConstElementPtr logger, loggers->listValue()) {
         parseConfigEntry(logger);
     }
index f7cd8c5fc83e4e80a1a77dbd85558fd9995172b7..92209bd17fec2f7f5ffb79e211b56290c589bfc4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -39,7 +39,7 @@ namespace process {
 /// The data structures don't have to originate from JSON. JSON is just a
 /// convenient presentation syntax.
 ///
-/// This class uses @c SrvConfig object to store logging configuration.
+/// This class uses @c ConfigBase object to store logging configuration.
 class LogConfigParser {
 public:
 
@@ -60,10 +60,10 @@ public:
 
 private:
 
-    /// @brief Parses one JSON structure in Logging/loggers" array
+    /// @brief Parses one JSON structure in Server/loggers" array
     ///
     /// @param entry JSON structure to be parsed
-    /// @brief parses one structure in Logging/loggers.
+    /// @brief parses one structure in Server/loggers.
     void parseConfigEntry(isc::data::ConstElementPtr entry);
 
     /// @brief Parses output_options structure
index 22d140063e491fdbc090d1d178618dc23780c1cc..537cae2c3d0dbecc13390c1a16309eb7604c9d41 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -273,6 +273,58 @@ TEST_F(DaemonTest, PIDFileCleanup) {
     EXPECT_EQ(errno, ENOENT);
 }
 
+// Check that relocateLogging method is behaving properly with no Logging.
+TEST_F(DaemonTest, relocateLoggingNoLogging) {
+    std::string config_txt = "{ \"myServer\": { } }";
+    ConstElementPtr config = Element::fromJSON(config_txt);
+    ConstElementPtr expected = Element::fromJSON(config_txt);
+    Daemon x;
+    EXPECT_NO_THROW(x.relocateLogging(config, "myServer"));
+    EXPECT_TRUE(expected->equals(*config));
+}
+
+// Check that relocateLogging method is behaving properly with empty Logging.
+TEST_F(DaemonTest, relocateLoggingEmptyLogging) {
+    std::string config_txt =
+        "{ \"myServer\": { },\n"
+        "  \"Logging\": { } }";
+    ConstElementPtr config = Element::fromJSON(config_txt);
+    std::string expected_txt = "{ \"myServer\": { } }";
+    ConstElementPtr expected = Element::fromJSON(expected_txt);
+    Daemon x;
+    EXPECT_NO_THROW(x.relocateLogging(config, "myServer"));
+    EXPECT_TRUE(expected->equals(*config));
+}
+
+// Check that relocateLogging method is behaving properly.
+TEST_F(DaemonTest, relocateLogging) {
+    std::string config_txt =
+        "{ \"myServer\": { },\n"
+        "  \"Logging\": {\n"
+        "    \"loggers\": [ ] } }";
+    ConstElementPtr config = Element::fromJSON(config_txt);
+    std::string expected_txt =
+        "{ \"myServer\": {\n"
+        "  \"loggers\": [ ] } }";
+    ConstElementPtr expected = Element::fromJSON(expected_txt);
+    Daemon x;
+    EXPECT_NO_THROW(x.relocateLogging(config, "myServer"));
+    EXPECT_TRUE(expected->equals(*config));
+}
+
+// Check that relocateLogging method is behaving properly with extra objects.
+TEST_F(DaemonTest, relocateLoggingExtraObjects) {
+    std::string config_txt =
+        "{ \"myServer\": { },\n"
+        "  \"Foobar\": { } }";
+    ConstElementPtr config = Element::fromJSON(config_txt);
+    std::string expected_txt = "{ \"myServer\": { } }";
+    ConstElementPtr expected = Element::fromJSON(expected_txt);
+    Daemon x;
+    EXPECT_NO_THROW(x.relocateLogging(config, "myServer"));
+    EXPECT_TRUE(expected->equals(*config));
+}
+
 // Checks that configureLogger method is behaving properly.
 // More dedicated tests are available for LogConfigParser class.
 // See logger_unittest.cc