From: Marcin Siodelski Date: Thu, 7 May 2015 10:23:34 +0000 (+0200) Subject: [3806] New debug level for the dhcp4_srv loggers. X-Git-Tag: trac3513_base~6^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=334e6942da1d7e356e79b3e5d3c7412cd542b4bf;p=thirdparty%2Fkea.git [3806] New debug level for the dhcp4_srv loggers. Also, revised the debug levels for all messages in the Dhcp4Srv class. --- diff --git a/src/bin/dhcp4/dhcp4_log.h b/src/bin/dhcp4/dhcp4_log.h index ac791c06d6..11af647c67 100644 --- a/src/bin/dhcp4/dhcp4_log.h +++ b/src/bin/dhcp4/dhcp4_log.h @@ -43,6 +43,15 @@ const int DBG_DHCP4_BASIC = DBGLVL_TRACE_BASIC; /// @brief Debug level used to trace hook related operations const int DBG_DHCP4_HOOKS = DBGLVL_TRACE_BASIC; +/// @brief Debug level used to log the traces with some basic data. +/// +/// The basic data includes summary information, e.g. summary of the +/// information returned by the particular function. It may also include +/// more detailed information in cases when it is warranted and the +/// extraction of the data doesn't impact the server's performance +/// significantly. +const int DBG_DHCP4_BASIC_DATA = DBGLVL_TRACE_BASIC_DATA; + /// @brief Debug level used to trace detailed errors. /// /// Trace detailed operations, including errors raised when processing invalid diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 2899df1450..44622161b6 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -291,7 +291,7 @@ Dhcpv4Srv::selectSubnet(const Pkt4Ptr& query) const { if (subnet) { // Log at higher debug level that subnet has been found. - LOG_DEBUG(packet_logger, DBG_DHCP4_DETAIL, DHCP4_SUBNET_SELECTED) + LOG_DEBUG(packet_logger, DBG_DHCP4_BASIC_DATA, DHCP4_SUBNET_SELECTED) .arg(query->getLabel()) .arg(subnet->getID()); // Log detailed information about the selected subnet at the @@ -347,7 +347,7 @@ Dhcpv4Srv::run() { // point are: the interface, source address and destination addresses // and ports. if (query) { - LOG_DEBUG(packet_logger, DBG_DHCP4_DETAIL, DHCP4_BUFFER_RECEIVED) + LOG_DEBUG(packet_logger, DBG_DHCP4_BASIC, DHCP4_BUFFER_RECEIVED) .arg(query->getRemoteAddr().toText()) .arg(query->getRemotePort()) .arg(query->getLocalAddr().toText()) @@ -481,7 +481,7 @@ Dhcpv4Srv::run() { // We have sanity checked (in accept() that the Message Type option // exists, so we can safely get it here. int type = query->getType(); - LOG_DEBUG(packet_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_RECEIVED) + LOG_DEBUG(packet_logger, DBG_DHCP4_BASIC_DATA, DHCP4_PACKET_RECEIVED) .arg(query->getLabel()) .arg(query->getName()) .arg(type) @@ -641,14 +641,7 @@ Dhcpv4Srv::run() { callout_handle->getArgument("response4", rsp); } - LOG_DEBUG(options_logger, DBG_DHCP4_DETAIL_DATA, - DHCP4_RESPONSE_DATA) - .arg(rsp->getLabel()) - .arg(rsp->getName()) - .arg(static_cast(rsp->getType())) - .arg(rsp->toText()); - - LOG_DEBUG(packet_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_SEND) + LOG_DEBUG(packet_logger, DBG_DHCP4_BASIC, DHCP4_PACKET_SEND) .arg(rsp->getLabel()) .arg(rsp->getName()) .arg(static_cast(rsp->getType())) @@ -657,7 +650,13 @@ Dhcpv4Srv::run() { .arg(rsp->getRemoteAddr()) .arg(rsp->getRemotePort()) .arg(rsp->getIface()); - + + LOG_DEBUG(packet_logger, DBG_DHCP4_DETAIL_DATA, + DHCP4_RESPONSE_DATA) + .arg(rsp->getLabel()) + .arg(rsp->getName()) + .arg(static_cast(rsp->getType())) + .arg(rsp->toText()); sendPacket(rsp); } catch (const std::exception& e) { LOG_ERROR(packet_logger, DHCP4_PACKET_SEND_FAIL) @@ -890,7 +889,7 @@ Dhcpv4Srv::processClientName(Dhcpv4Exchange& ex) { Option4ClientFqdnPtr fqdn = boost::dynamic_pointer_cast (ex.getQuery()->getOption(DHO_FQDN)); if (fqdn) { - LOG_DEBUG(hostname_logger, DBG_DHCP4_BASIC, DHCP4_CLIENT_FQDN_PROCESS) + LOG_DEBUG(hostname_logger, DBG_DHCP4_DETAIL, DHCP4_CLIENT_FQDN_PROCESS) .arg(ex.getQuery()->getLabel()); processClientFqdnOption(ex); @@ -898,7 +897,7 @@ Dhcpv4Srv::processClientName(Dhcpv4Exchange& ex) { OptionStringPtr hostname = boost::dynamic_pointer_cast (ex.getQuery()->getOption(DHO_HOST_NAME)); if (hostname) { - LOG_DEBUG(hostname_logger, DBG_DHCP4_BASIC, DHCP4_CLIENT_HOSTNAME_PROCESS) + LOG_DEBUG(hostname_logger, DBG_DHCP4_DETAIL, DHCP4_CLIENT_HOSTNAME_PROCESS) .arg(ex.getQuery()->getLabel()); processHostnameOption(ex); } @@ -1285,7 +1284,7 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) { if (lease) { // We have a lease! Let's set it in the packet and send it back to // the client. - LOG_DEBUG(lease_logger, DBG_DHCP4_DETAIL, fake_allocation? + LOG_DEBUG(lease_logger, DBG_DHCP4_BASIC_DATA, fake_allocation? DHCP4_LEASE_ADVERT : DHCP4_LEASE_ALLOC) .arg(query->getLabel()) .arg(lease->addr_.toText()); @@ -1652,7 +1651,7 @@ Dhcpv4Srv::processRequest(Pkt4Ptr& request) { /// doing class specific processing. if (!classSpecificProcessing(ex)) { /// @todo add more verbosity here - LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_REQUEST_CLASS_PROCESSING_FAILED) + LOG_DEBUG(options_logger, DBG_DHCP4_DETAIL, DHCP4_REQUEST_CLASS_PROCESSING_FAILED) .arg(ex.getQuery()->getLabel()); }