- Split the 15 occurrences of EVAL_RESULT into one message for each log call in code.
- Log all these messages only on debug level 50.
- Remove bad practice `catch (...)` and the message logged on that if-branch.
extern const isc::log::MessageID DHCP4_RELEASE_FAIL_NO_LEASE = "DHCP4_RELEASE_FAIL_NO_LEASE";
extern const isc::log::MessageID DHCP4_RELEASE_FAIL_WRONG_CLIENT = "DHCP4_RELEASE_FAIL_WRONG_CLIENT";
extern const isc::log::MessageID DHCP4_REQUEST = "DHCP4_REQUEST";
+extern const isc::log::MessageID DHCP4_REQUIRED_CLASS_EVAL_ERROR = "DHCP4_REQUIRED_CLASS_EVAL_ERROR";
+extern const isc::log::MessageID DHCP4_REQUIRED_CLASS_EVAL_RESULT = "DHCP4_REQUIRED_CLASS_EVAL_RESULT";
extern const isc::log::MessageID DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED = "DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED";
extern const isc::log::MessageID DHCP4_RESERVED_HOSTNAME_ASSIGNED = "DHCP4_RESERVED_HOSTNAME_ASSIGNED";
extern const isc::log::MessageID DHCP4_RESPONSE_DATA = "DHCP4_RESPONSE_DATA";
"DHCP4_RELEASE_FAIL_NO_LEASE", "%1: client is trying to release non-existing lease %2",
"DHCP4_RELEASE_FAIL_WRONG_CLIENT", "%1: client is trying to release the lease %2 which belongs to a different client",
"DHCP4_REQUEST", "%1: server is processing DHCPREQUEST with hint=%2",
+ "DHCP4_REQUIRED_CLASS_EVAL_ERROR", "%1: Expression '%2' evaluated to %3",
+ "DHCP4_REQUIRED_CLASS_EVAL_RESULT", "%1: Expression '%2' evaluated to %3",
"DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED", "Multi-threading is enabled and host reservations lookup is always performed first.",
"DHCP4_RESERVED_HOSTNAME_ASSIGNED", "%1: server assigned reserved hostname %2",
"DHCP4_RESPONSE_DATA", "%1: responding with packet %2 (type %3), packet details: %4",
extern const isc::log::MessageID DHCP4_RELEASE_FAIL_NO_LEASE;
extern const isc::log::MessageID DHCP4_RELEASE_FAIL_WRONG_CLIENT;
extern const isc::log::MessageID DHCP4_REQUEST;
+extern const isc::log::MessageID DHCP4_REQUIRED_CLASS_EVAL_ERROR;
+extern const isc::log::MessageID DHCP4_REQUIRED_CLASS_EVAL_RESULT;
extern const isc::log::MessageID DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED;
extern const isc::log::MessageID DHCP4_RESERVED_HOSTNAME_ASSIGNED;
extern const isc::log::MessageID DHCP4_RESPONSE_DATA;
If there is no hint, the argument should provide the text indicating
that the hint hasn't been sent.
+% DHCP4_REQUIRED_CLASS_EVAL_ERROR %1: Expression '%2' evaluated to %3
+This error message indicates that there a problem was encountered while
+evaluating an expression of a client class that was marked as required.
+A description of the problem is printed.
+
+% DHCP4_REQUIRED_CLASS_EVAL_RESULT %1: Expression '%2' evaluated to %3
+Logged at debug log level 50.
+This debug message indicates that the expression of a client class has been
+successfully evaluated. The client class name and the result value of the
+evaluation are printed.
+
% DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED Multi-threading is enabled and host reservations lookup is always performed first.
This is a message informing that host reservations lookup is performed before
lease lookup when multi-threading is enabled overwriting configured value.
// true (match) or raise an exception (error)
try {
bool status = evaluateBool(*expr_ptr, *query);
+ LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_REQUIRED_CLASS_EVAL_RESULT)
+ .arg(query->getLabel())
+ .arg(cclass)
+ .arg(status ? "true" : "false");
if (status) {
- LOG_INFO(dhcp4_logger, EVAL_RESULT)
- .arg(query->getLabel())
- .arg(cclass)
- .arg("true");
// Matching: add the class
query->addClass(cclass);
- } else {
- LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, EVAL_RESULT)
- .arg(query->getLabel())
- .arg(cclass)
- .arg("false");
}
} catch (const Exception& ex) {
- LOG_ERROR(dhcp4_logger, EVAL_RESULT)
+ LOG_ERROR(dhcp4_logger, DHCP4_REQUIRED_CLASS_EVAL_ERROR)
.arg(query->getLabel())
.arg(cclass)
.arg(ex.what());
- } catch (...) {
- LOG_ERROR(dhcp4_logger, EVAL_RESULT)
- .arg(query->getLabel())
- .arg(cclass)
- .arg("get exception?");
}
}
}
extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL = "DHCP6_RELEASE_PD_FAIL";
extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_DUID = "DHCP6_RELEASE_PD_FAIL_WRONG_DUID";
extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_IAID = "DHCP6_RELEASE_PD_FAIL_WRONG_IAID";
+extern const isc::log::MessageID DHCP6_REQUIRED_CLASS_EVAL_ERROR = "DHCP6_REQUIRED_CLASS_EVAL_ERROR";
+extern const isc::log::MessageID DHCP6_REQUIRED_CLASS_EVAL_RESULT = "DHCP6_REQUIRED_CLASS_EVAL_RESULT";
extern const isc::log::MessageID DHCP6_REQUIRED_OPTIONS_CHECK_FAIL = "DHCP6_REQUIRED_OPTIONS_CHECK_FAIL";
extern const isc::log::MessageID DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED = "DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED";
extern const isc::log::MessageID DHCP6_RESPONSE_DATA = "DHCP6_RESPONSE_DATA";
"DHCP6_RELEASE_PD_FAIL", "%1: failed to release prefix %2/%3 for iaid=%4",
"DHCP6_RELEASE_PD_FAIL_WRONG_DUID", "%1: client tried to release prefix %2/%3, but it belongs to another client (duid=%4)",
"DHCP6_RELEASE_PD_FAIL_WRONG_IAID", "%1: client tried to release prefix %2/%3, but it used wrong IAID (expected %4, but got %5)",
+ "DHCP6_REQUIRED_CLASS_EVAL_ERROR", "%1: Expression '%2' evaluated to %3",
+ "DHCP6_REQUIRED_CLASS_EVAL_RESULT", "%1: Expression '%2' evaluated to %3",
"DHCP6_REQUIRED_OPTIONS_CHECK_FAIL", "%1: %2 message received from %3 failed the following check: %4",
"DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED", "Multi-threading is enabled and host reservations lookup is always performed first.",
"DHCP6_RESPONSE_DATA", "%1: responding with packet %2 (type %3), packet details: %4",
extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL;
extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_DUID;
extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_IAID;
+extern const isc::log::MessageID DHCP6_REQUIRED_CLASS_EVAL_ERROR;
+extern const isc::log::MessageID DHCP6_REQUIRED_CLASS_EVAL_RESULT;
extern const isc::log::MessageID DHCP6_REQUIRED_OPTIONS_CHECK_FAIL;
extern const isc::log::MessageID DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED;
extern const isc::log::MessageID DHCP6_RESPONSE_DATA;
argument identify the prefix. The fourth and fifth argument hold the
expected IAID and IAID found respectively.
+% DHCP6_REQUIRED_CLASS_EVAL_ERROR %1: Expression '%2' evaluated to %3
+This error message indicates that there a problem was encountered while
+evaluating an expression of a client class that was marked as required.
+A description of the problem is printed.
+
+% DHCP6_REQUIRED_CLASS_EVAL_RESULT %1: Expression '%2' evaluated to %3
+Logged at debug log level 50.
+This debug message indicates that the expression of a client class has been
+successfully evaluated. The client class name and the result value of the
+evaluation are printed.
+
% DHCP6_REQUIRED_OPTIONS_CHECK_FAIL %1: %2 message received from %3 failed the following check: %4
Logged at debug log level 40.
This message indicates that received DHCPv6 packet is invalid. This may be due
// true (match) or raise an exception (error)
try {
bool status = evaluateBool(*expr_ptr, *pkt);
+ LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL, DHCP6_REQUIRED_CLASS_EVAL_RESULT)
+ .arg(pkt->getLabel())
+ .arg(cclass)
+ .arg(status ? "true" : "false");
if (status) {
- LOG_INFO(dhcp6_logger, EVAL_RESULT)
- .arg(pkt->getLabel())
- .arg(cclass)
- .arg("true");
// Matching: add the class
pkt->addClass(cclass);
- } else {
- LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL, EVAL_RESULT)
- .arg(pkt->getLabel())
- .arg(cclass)
- .arg("false");
}
} catch (const Exception& ex) {
- LOG_ERROR(dhcp6_logger, EVAL_RESULT)
+ LOG_ERROR(dhcp6_logger, DHCP6_REQUIRED_CLASS_EVAL_ERROR)
.arg(pkt->getLabel())
.arg(cclass)
.arg(ex.what());
- } catch (...) {
- LOG_ERROR(dhcp6_logger, EVAL_RESULT)
- .arg(pkt->getLabel())
- .arg(cclass)
- .arg("get exception?");
}
}
}
-// File created from config_messages.mes
+// File created from ../../../src/lib/config/config_messages.mes
#include <cstddef>
#include <log/message_types.h>
"COMMAND_WATCH_SOCKET_MARK_READY_ERROR", "watch socket failed to mark ready: %1",
"HTTP_COMMAND_MGR_IGNORED_TLS_SETUP_CHANGES", "ignore a change in TLS setup of the http control socket",
"HTTP_COMMAND_MGR_SERVICE_STARTED", "started %1 service bound to address %2 port %3",
- "HTTP_COMMAND_MGR_SERVICE_STOPPING", "stopping %1 service%2",
+ "HTTP_COMMAND_MGR_SERVICE_STOPPING", "stopping %1 service %2",
NULL
};
-// File created from config_messages.mes
+// File created from ../../../src/lib/config/config_messages.mes
#ifndef CONFIG_MESSAGES_H
#define CONFIG_MESSAGES_H
// true (match) or raise an exception (error)
try {
bool status = evaluateBool(*expr_ptr, *pkt);
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_EVAL_RESULT)
+ .arg(pkt->getLabel())
+ .arg(getName())
+ .arg(status ? "true" : "false");
if (status) {
- LOG_INFO(dhcpsrv_logger, EVAL_RESULT)
- .arg(pkt->getLabel())
- .arg(getName())
- .arg("true");
// Matching: add the class
pkt->addClass(getName());
- } else {
- LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, EVAL_RESULT)
- .arg(pkt->getLabel())
- .arg(getName())
- .arg("false");
}
} catch (const Exception& ex) {
- LOG_ERROR(dhcpsrv_logger, EVAL_RESULT)
+ LOG_ERROR(dhcpsrv_logger, DHCPSRV_EVAL_ERROR)
.arg(pkt->getLabel())
.arg(getName())
.arg(ex.what());
- } catch (...) {
- LOG_ERROR(dhcpsrv_logger, EVAL_RESULT)
- .arg(pkt->getLabel())
- .arg(getName())
- .arg("get exception?");
}
}
try {
std::string subclass = evaluateString(*expr_ptr, *pkt);
if (!subclass.empty()) {
- LOG_INFO(dhcpsrv_logger, EVAL_RESULT)
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_TEMPLATE_EVAL_RESULT)
.arg(pkt->getLabel())
.arg(getName())
.arg(subclass);
pkt->addSubClass(getName(), value);
}
} catch (const Exception& ex) {
- LOG_ERROR(dhcpsrv_logger, EVAL_RESULT)
+ LOG_ERROR(dhcpsrv_logger, DHCPSRV_TEMPLATE_EVAL_ERROR)
.arg(pkt->getLabel())
.arg(getName())
.arg(ex.what());
- } catch (...) {
- LOG_ERROR(dhcpsrv_logger, EVAL_RESULT)
- .arg(pkt->getLabel())
- .arg(getName())
- .arg("get exception?");
}
}
extern const isc::log::MessageID DHCPSRV_DHCP_DDNS_SENDER_STARTED = "DHCPSRV_DHCP_DDNS_SENDER_STARTED";
extern const isc::log::MessageID DHCPSRV_DHCP_DDNS_SENDER_STOPPED = "DHCPSRV_DHCP_DDNS_SENDER_STOPPED";
extern const isc::log::MessageID DHCPSRV_DHCP_DDNS_SUSPEND_UPDATES = "DHCPSRV_DHCP_DDNS_SUSPEND_UPDATES";
+extern const isc::log::MessageID DHCPSRV_EVAL_ERROR = "DHCPSRV_EVAL_ERROR";
+extern const isc::log::MessageID DHCPSRV_EVAL_RESULT = "DHCPSRV_EVAL_RESULT";
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE4_RECOVER_SKIP = "DHCPSRV_HOOK_LEASE4_RECOVER_SKIP";
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE4_RENEW_SKIP = "DHCPSRV_HOOK_LEASE4_RENEW_SKIP";
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE4_SELECT_SKIP = "DHCPSRV_HOOK_LEASE4_SELECT_SKIP";
extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_NO_MATCH = "DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_NO_MATCH";
extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_NO_MATCH = "DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_NO_MATCH";
extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_NO_MATCH = "DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_NO_MATCH";
+extern const isc::log::MessageID DHCPSRV_TEMPLATE_EVAL_ERROR = "DHCPSRV_TEMPLATE_EVAL_ERROR";
+extern const isc::log::MessageID DHCPSRV_TEMPLATE_EVAL_RESULT = "DHCPSRV_TEMPLATE_EVAL_RESULT";
extern const isc::log::MessageID DHCPSRV_TIMERMGR_CALLBACK_FAILED = "DHCPSRV_TIMERMGR_CALLBACK_FAILED";
extern const isc::log::MessageID DHCPSRV_TIMERMGR_REGISTER_TIMER = "DHCPSRV_TIMERMGR_REGISTER_TIMER";
extern const isc::log::MessageID DHCPSRV_TIMERMGR_RUN_TIMER_OPERATION = "DHCPSRV_TIMERMGR_RUN_TIMER_OPERATION";
"DHCPSRV_DHCP_DDNS_SENDER_STARTED", "NameChangeRequest sender has been started: %1",
"DHCPSRV_DHCP_DDNS_SENDER_STOPPED", "NameChangeRequest sender has been stopped.",
"DHCPSRV_DHCP_DDNS_SUSPEND_UPDATES", "DHCP_DDNS updates are being suspended.",
+ "DHCPSRV_EVAL_ERROR", "%1: Expression '%2' evaluated to %3",
+ "DHCPSRV_EVAL_RESULT", "%1: Expression '%2' evaluated to %3",
"DHCPSRV_HOOK_LEASE4_RECOVER_SKIP", "DHCPv4 lease %1 was not recovered from the declined state because a callout set the skip status.",
"DHCPSRV_HOOK_LEASE4_RENEW_SKIP", "DHCPv4 lease was not renewed because a callout set the skip flag.",
"DHCPSRV_HOOK_LEASE4_SELECT_SKIP", "Lease4 creation was skipped, because of callout skip flag.",
"DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_NO_MATCH", "No subnet matches address: %1",
"DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_NO_MATCH", "No subnet matches interface id: %1",
"DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_NO_MATCH", "No subnet matches interface: %1",
+ "DHCPSRV_TEMPLATE_EVAL_ERROR", "%1: Expression '%2' evaluated to %3",
+ "DHCPSRV_TEMPLATE_EVAL_RESULT", "%1: Expression '%2' evaluated to %3",
"DHCPSRV_TIMERMGR_CALLBACK_FAILED", "running handler for timer %1 caused exception: %2",
"DHCPSRV_TIMERMGR_REGISTER_TIMER", "registering timer: %1, using interval: %2 ms",
"DHCPSRV_TIMERMGR_RUN_TIMER_OPERATION", "running operation for timer: %1",
extern const isc::log::MessageID DHCPSRV_DHCP_DDNS_SENDER_STARTED;
extern const isc::log::MessageID DHCPSRV_DHCP_DDNS_SENDER_STOPPED;
extern const isc::log::MessageID DHCPSRV_DHCP_DDNS_SUSPEND_UPDATES;
+extern const isc::log::MessageID DHCPSRV_EVAL_ERROR;
+extern const isc::log::MessageID DHCPSRV_EVAL_RESULT;
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE4_RECOVER_SKIP;
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE4_RENEW_SKIP;
extern const isc::log::MessageID DHCPSRV_HOOK_LEASE4_SELECT_SKIP;
extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_NO_MATCH;
extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_NO_MATCH;
extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_NO_MATCH;
+extern const isc::log::MessageID DHCPSRV_TEMPLATE_EVAL_ERROR;
+extern const isc::log::MessageID DHCPSRV_TEMPLATE_EVAL_RESULT;
extern const isc::log::MessageID DHCPSRV_TIMERMGR_CALLBACK_FAILED;
extern const isc::log::MessageID DHCPSRV_TIMERMGR_REGISTER_TIMER;
extern const isc::log::MessageID DHCPSRV_TIMERMGR_RUN_TIMER_OPERATION;
log with details. No further attempts to communicate with kea-dhcp-ddns will
be made without intervention.
+% DHCPSRV_EVAL_ERROR %1: Expression '%2' evaluated to %3
+This error message indicates that there a problem was encountered while
+evaluating an expression of a client class.
+A description of the problem is printed.
+
+% DHCPSRV_EVAL_RESULT %1: Expression '%2' evaluated to %3
+Logged at debug log level 50.
+This debug message indicates that the expression of a client class has been
+successfully evaluated. The client class name and the result value of the
+evaluation are printed.
+
% DHCPSRV_HOOK_LEASE4_RECOVER_SKIP DHCPv4 lease %1 was not recovered from the declined state because a callout set the skip status.
Logged at debug log level 40.
This debug message is printed when a callout installed on lease4_recover
A debug message issued when the server was unable to select a subnet using
the specified interface name.
+% DHCPSRV_TEMPLATE_EVAL_ERROR %1: Expression '%2' evaluated to %3
+This error message indicates that there a problem was encountered while
+evaluating an expression of a template client class.
+A description of the problem is printed.
+
+% DHCPSRV_TEMPLATE_EVAL_RESULT %1: Expression '%2' evaluated to %3
+Logged at debug log level 50.
+This debug message indicates that the expression of a template client class has
+been successfully evaluated. The client class name and the result value of the
+evaluation are printed.
+
% DHCPSRV_TIMERMGR_CALLBACK_FAILED running handler for timer %1 caused exception: %2
This error message is emitted when the timer elapsed and the
operation associated with this timer has thrown an exception.
Logged at debug log level 55.
This debug message indicates that the expression has been evaluated
and vendor option was not found.
-
-% EVAL_RESULT %1: Expression %2 evaluated to %3
-Logged at debug log level 50.
-This debug message indicates that the expression has been evaluated
-to said value. This message is mostly useful during debugging of the
-client classification expressions.
% DHCP4_CLASS_ASSIGNED: 3
% DHCP4_PACKET_QUEUE_FULL: 2
% DHCP4_CONFIG_RECEIVED: 2
- % EVAL_RESULT: 15
% DHCP6_CLASSES_ASSIGNED: 8
% DHCP6_CLASS_ASSIGNED: 3
% DHCP6_PACKET_QUEUE_FULL: 2