Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2978 closed defect (fixed)

Use DHCPDDNS_XXX as prefix for D2 log messages.

Reported by: tmark Owned by: stephen
Priority: medium Milestone: Sprint-DHCP-20130620
Component: ~dhcp-ddns(obsolete) Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

Replace use of D2_ in the log message prefix with DHCPDDNS_ in D2 log messages. This was moved from review comments on 2955 to a separate ticket for ease of review.

Subtickets

Change History (9)

comment:1 Changed 7 years ago by tmark

  • Owner set to tmark
  • Status changed from new to assigned

comment:2 Changed 7 years ago by tmark

  • Status changed from assigned to accepted

comment:3 Changed 7 years ago by tmark

  • Owner changed from tmark to UnAssigned
  • Status changed from accepted to reviewing

What started out as a rather simple ticket, turned out to be a bit more work
but the result is much better. Since the base classes are intended to be
reused, for other modules, log statements emanating from them should not be
hard-coded to refer to DHCP-DDNS. So I split the messages logically (they're
still in one .mes file) into those emanating from the base, and those emanating
from DHCP-DDNS derivation. Those from the base are prefixed now with DCTL_,
those from the derivation are prefixed with DHCP_DDNS_.

Going a step further, I renamed the name_ members of DControllerBase and
DProcessBase to be app_name_. This value is displayed in base class log
statements. I added a second member to DControllerBase, bin_name_. This is
the executable or module name. This value is what is used to initialize the
logger. In this manner each derivation supplies its own names for use in the
base class logging.

For D2, these values are:

/ @brief Defines the application name, this is passed into base class
/ and appears in log statements.
const char* D2Controller::d2_app_name_ = "Dhcp-Ddns";

/ @brief Defines the executable name. This is passed into the base class
/ by convention this should match the BIND10 module name.
const char* D2Controller::d2_bin_name_ = "b10-dhcp-ddns";

Lastly, I changed the logger name from "d2_logger" to "dctl".

What follows is an excerpt from BIND10's log so you can see the net affect:

2013-06-07 16:06:03.452 DEBUG [b10-init.init/84985] BIND10_STARTED_PROCESS_PID started b10-dhcp-ddns (PID 84990)
2013-06-07 16:06:03.460 DEBUG [b10-dhcp-ddns.dctl/84990] DCTL_STARTING Dhcp-Ddns controller starting, pid: 84990
2013-06-07 16:06:03.460 DEBUG [b10-dhcp-ddns.dctl/84990] DCTL_INIT_PROCESS Dhcp-Ddns initializing the application
2013-06-07 16:06:03.461 DEBUG [b10-dhcp-ddns.dctl/84990] DCTL_CONFIG_STUB Dhcp-Ddns configuration stub handler called
2013-06-07 16:06:03.461 DEBUG [b10-dhcp-ddns.config/84990] CONFIG_LOG_WILD_MATCH will use logging configuration for wildcard logger *
2013-06-07 16:06:03.461 DEBUG [b10-dhcp-ddns.dctl/84990] DCTL_CONFIG_UPDATE Dhcp-Ddns updated configuration received: { "spiffy": "wahoo" }
2013-06-07 16:06:03.461 DEBUG [b10-dhcp-ddns.dctl/84990] DHCP_DDNS_CONFIGURE configuration update received: { "spiffy": "wahoo" }
2013-06-07 16:06:03.462 DEBUG [b10-dhcp-ddns.dctl/84990] DCTL_RUN_PROCESS Dhcp-Ddns starting application event loop
2013-06-07 16:06:03.462 DEBUG [b10-dhcp-ddns.dctl/84990] DHCP_DDNS_RUN_ENTER application has entered the event loop
2013-06-07 16:07:19.453 DEBUG [b10-dhcp-ddns.dctl/84990] DCTL_CONFIG_UPDATE Dhcp-Ddns updated configuration received: { "spiffy": "you betcha" }
2013-06-07 16:07:19.453 DEBUG [b10-dhcp-ddns.dctl/84990] DHCP_DDNS_CONFIGURE configuration update received: { "spiffy": "you betcha" }
2013-06-07 16:07:34.212 DEBUG [b10-dhcp-ddns.dctl/84990] DCTL_COMMAND_RECEIVED Dhcp-Ddns received command status, arguments: {  }
2013-06-07 16:07:34.213 DEBUG [b10-dhcp-ddns.dctl/84990] DHCP_DDNS_COMMAND command directive received, command: status - args: {  }
2013-06-07 16:07:47.853 DEBUG [b10-dhcp-ddns.dctl/84990] DCTL_COMMAND_RECEIVED Dhcp-Ddns received command shutdown, arguments: {  }
2013-06-07 16:07:47.853 DEBUG [b10-dhcp-ddns.dctl/84990] DHCP_DDNS_SHUTDOWN application is performing a normal shut down
2013-06-07 16:07:47.853 DEBUG [b10-dhcp-ddns.dctl/84990] DHCP_DDNS_RUN_EXIT application is exiting the event loop
2013-06-07 16:07:47.854 INFO  [b10-dhcp-ddns.dctl/84990] DCTL_STOPPING Dhcp-Ddns controller is exiting
2013-06-07 16:07:47.854 INFO  [b10-init.init/84985] BIND10_PROCESS_ENDED process 84990 of b10-dhcp-ddns ended with status 0
2013-06-07 16:07:47.854 ERROR [b10-init.init/84985] BIND10_COMPONENT_FAILED component b10-dhcp-ddns (pid 84990) failed: process e

comment:4 Changed 7 years ago by stephen

  • Owner changed from UnAssigned to stephen

comment:5 follow-up: Changed 7 years ago by stephen

  • Owner changed from stephen to tmark

Reviewed commit 4ee45a9b6fe66798c2aa22ecfc6b9522b9ba8d37

src/bin/d2/d2_controller.cc
d2_app_name_: it's not really usual to use an initial capital letter in dhcp or dns - they are generally written as all capitals or all lower-case. In this instance, upper-case may be better (DHCP-DDNS) or expand it: "DHCP DDNS client"

src/bin/d2/d2_log.cc
Not sure about "dctl" as the string used to identify the logger (although dctl_logger is OK as the name of the variable in the code). The string is used by the user in the configuration to change the logging for that module, so names like dhcpdns or dhcpddns are better.

This probably requires a ChangeLog entry.

comment:6 Changed 7 years ago by tmark

  • Owner changed from tmark to stephen

Reviewed commit 4ee45a9b6fe66798c2aa22ecfc6b9522b9ba8d37

src/bin/d2/d2_controller.cc
d2_app_name_: it's not really usual to use an initial capital letter in dhcp or dns - they are generally written as all capitals or all lower-case. In this i

nstance, upper-case may be better (DHCP-DDNS) or expand it: "DHCP DDNS client"

I have upper-cased it.


src/bin/d2/d2_log.cc
Not sure about "dctl" as the string used to identify the logger (although dctl_logger is OK as the name of the variable in the code). The string is used by the user in the configuration to change the logging for that module, so names like dhcpdns or dhcpddns are better.

I have changed it to dhcpddns.

This probably requires a ChangeLog entry.

I'm guessing this is to announce the existence of a new logger?

6xx [func] tmark

Logger name for DHCP-DDNS has been changed from "d2_logger" to "dhcpddns".
In addition, its log messages now use two suffixes, DCTL_ for logs the
emanate from the underlying base classes, and DHCP_DDNS_ for logs which
emanate from DHCP-DDNS specific code

comment:7 in reply to: ↑ 5 Changed 7 years ago by jreed

Replying to stephen:

This probably requires a ChangeLog entry.

A changelog entry is not needed for naming change since never released or announced before. But maybe won't hurt for a new or an existing entry to introduce it.

comment:8 Changed 7 years ago by tmark

  • Resolution set to fixed
  • Status changed from reviewing to closed

Changes merged into master, git 5aec5fb20b0486574226f89bd877267cb9116921.
Added entry 627 to ChangeLog.

comment:9 Changed 7 years ago by tmark

  • Component changed from dhcp to dhcp-ddns
Note: See TracTickets for help on using tickets.