Commit 641e7b2a authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[3427] Changes after review

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