\"command\": \"config-set\",
\"arguments\": {
\"<server>\": {
- },
- \"Logging\": {
}
}
}",
\"command\": \"config-test\",
\"arguments\": {
\"<server>\": {
- },
- \"Logging\": {
}
}
}",
"socket-type": "unix",
"socket-name": "/path/to/the/unix/socket-v4"
}
- }
+ },
- },
-
- "Logging":
- {
// In loggers
"loggers": [
{
"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",
"algorithm": "HMAC-MD5",
"secret": "LSWXnfkKZjdPJI5QxlpnfQ=="
}
- ]
-},
+ ],
-"Logging": {
// In loggers
"loggers": [
{
"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",
"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": [
"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": [
// 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": [
"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",
"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",
"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",
{ "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",
"dhcp-ddns": {
"comment": "No dynamic DNS",
"enable-updates": false
- }
-},
+ },
-"Logging": {
// In loggers
"loggers": [ {
"comment": "A logger",
],
// This enables DHCPv4-over-DHCPv6 support
- "dhcp4o6-port": 6767
+ "dhcp4o6-port": 6767,
-},
-
-"Logging":
-{
"loggers": [
{
"name": "kea-dhcp4",
"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",
// 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
"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",
}
]
} ]
- } ]
-},
+ } ],
// 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",
"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",
"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",
]
}
- ]
-},
+ ],
// 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",
{
"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",
"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",
"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",
"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",
"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": [
// 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": [
"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",
"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",
"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",
]
}
- ]
-},
+ ],
// 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",
"dhcp-ddns": {
"comment": "No dynamic DNS",
"enable-updates": false
- }
-},
+ },
-"Logging": {
// In loggers
"loggers": [ {
"comment": "A logger",
"csv-format": true,
// Put the server address here
"data": "2001:db8:1:1::1" }
- ]
-},
+ ],
-"Logging":
-{
- "loggers": [
+ "loggers": [
{
"name": "kea-dhcp6",
"output_options": [
"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",
],
"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",
"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",
"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",
"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",
"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",
"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",
]
}
- ]
-},
+ ],
// 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",
{ "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": [
"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",
}
]
}
- ]
-},
+ ],
// The following configures logging. Kea will log all debug messages
// to /var/log/kea-debug.log file.
-"Logging": {
"loggers": [
{
"name": "kea-dhcp6",
"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",
"socket-name": "/path/to/the/unix/socket-v4"
}
}
- }
+ },
- },
-
- "Logging":
- {
// In loggers
"loggers": [
{
"socket-name": "/tmp/kea6-sock"
}
}
- }
- },
- "Logging":
- {
+ },
+
"loggers":
[
{
"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",
"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",
<!--
- - 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"
"command": "config-set",
"arguments": {
"<server>": {
- },
- "Logging": {
}
}
}</screen>
"command": "config-test",
"arguments": {
"<server>": {
- },
- "Logging": {
}
}
}</screen>
<!--
- - 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>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.
"command": "config-test",
"arguments": {
"<server>": {
- },
- "Logging": {
}
}
}
"arguments": {
"Dhcp6": {
:
- },
- "Logging": {
- :
}
}
}
"command": "config-set",
"arguments": {
"<server>": {
- },
- "Logging": {
}
}
}
"arguments": {
"Dhcp6": {
:
- },
- "Logging": {
- :
}
}
}
<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>
</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>
"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": [ {
<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>
</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>
"space": "dhcp6",
"csv-format": true,
"data": "2001:db8:1:1::1"
- } ]
+ } ],
</userinput>
-},
-"Logging": {
"loggers": [ {
"name": "kea-dhcp6",
"output_options": [ {
<!--
- - 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>
</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",
<!--
- - 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
"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",
"socket-name": "/tmp/kea6-sock"
}
}
- }
- },
- "Logging":
- {
+ },
+
"loggers":
[
{
<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>
<config xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp6-server">
],
"subnet": "2001:db8::/64"
}
- ]
- },
- "Logging": {
+ ],
"loggers": [
{
"name": "kea-dhcp6",
-// 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
ElementPtr
CtrlAgentCfgContext::toElement() const {
- ElementPtr ca = Element::createMap();
+ ElementPtr ca = ConfigBase::toElement();
// Set user-context
contextToElement(ca);
// Set http-host
ElementPtr result = Element::createMap();
result->set("Control-agent", ca);
- // Set Logging (not yet)
-
return (result);
}
-// 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
///< 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;
-// 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
ElementPtr
D2CfgContext::toElement() const {
- ElementPtr d2 = Element::createMap();
+ ElementPtr d2 = ConfigBase::toElement();
// Set user-context
contextToElement(d2);
// Set ip-address
-// 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
///< 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
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 {
// 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);
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 {
// 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));
}
/// @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
/// @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
-# 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
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
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
(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);
-// 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
/// 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.
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 {
// 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);
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 {
// 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));
}
/// @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
/// @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
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
(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);
-// 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
/// 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.
// "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",
},
"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.
// 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
// 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.
// }
// }
// ]
-},
// 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",
-// 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
ElementPtr
NetconfConfig::toElement() const {
- ElementPtr netconf = Element::createMap();
+ ElementPtr netconf = ConfigBase::toElement();
// Set user-context
contextToElement(netconf);
// Add in explicitly configured globals.
// Set Netconf
ElementPtr result = Element::createMap();
result->set("Netconf", netconf);
-
- // Set Logging (not yet)
-
return (result);
}
-// 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
///< 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;
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());
-// 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
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 =
logger != logging_info_.cend(); ++logger) {
loggers->add(logger->toElement());
}
- logging->set("loggers", loggers);
- result->set("Logging", logging);
+ result->set("loggers", loggers);
}
// server-tag
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.
/// as JSON):
/// {{{
/// {
- /// "Logging": {
+ /// "Server": {
/// :
/// }
/// }
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();
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.
// 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;
///
/// @code
/// { "<module-name>": {<module-config>}
- ///
- /// # Logging element is optional
- /// ,"Logging": {<logger config}
/// }
///
/// where:
/// 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.
///
-// 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
#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
}
}
-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_);
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");
}
}
// Write the actual content using pretty printing.
- isc::data::prettyPrint(cfg, out);
+ prettyPrint(cfg, out);
size_t bytes = static_cast<size_t>(out.tellp());
-// 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
/// @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,
-// 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
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);
}
-// 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
/// 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:
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
-// 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
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