Commit 805401e5 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3804] Created new logger for callouts execution.

parent ebb901fb
......@@ -167,8 +167,14 @@
</listitem>
<listitem>
<simpara><command>kea-dhcp4.hooks</command> - this logger is used
during DHCPv4 hooks operation, i.e. anything related to user
libraries will be logged using this logger.</simpara>
to log messages related to management of hooks libraries, e.g.
registration and deregistration of the libraries.</simpara>
</listitem>
<listitem>
<simpara><command>kea-dhcp4.callouts</command> - this logger is used
to log messages pertaining to the callouts registration and execution
for the particular hook point.
</simpara>
</listitem>
<listitem>
<simpara><command>kea-dhcp6</command> - this is the root logger for
......@@ -189,8 +195,14 @@
</listitem>
<listitem>
<simpara><command>kea-dhcp6.hooks</command> - this logger is used
during DHCPv6 hooks operation, i.e. anything related to user
libraries will be logged using this logger.</simpara>
to log messages related to management of hooks libraries, e.g.
registration and deregistration of the libraries.</simpara>
</listitem>
<listitem>
<simpara><command>kea-dhcp6.callouts</command> - this logger is used
to log messages pertaining to the callouts registration and execution
for the particular hook point.
</simpara>
</listitem>
<listitem>
<simpara><command>kea-dhcp-ddns</command> - this is the root logger for
......
......@@ -66,7 +66,7 @@ CalloutManager::checkLibraryIndex(int library_index) const {
void
CalloutManager::registerCallout(const std::string& name, CalloutPtr callout) {
// Note the registration.
LOG_DEBUG(hooks_logger, HOOKS_DBG_CALLS, HOOKS_CALLOUT_REGISTRATION)
LOG_DEBUG(callouts_logger, HOOKS_DBG_CALLS, HOOKS_CALLOUT_REGISTRATION)
.arg(current_library_).arg(name);
// Sanity check that the current library index is set to a valid value.
......@@ -140,7 +140,7 @@ CalloutManager::callCallouts(int hook_index, CalloutHandle& callout_handle) {
util::Stopwatch stopwatch;
// Mark that the callouts begin for the hook.
LOG_DEBUG(hooks_logger, HOOKS_DBG_CALLS, HOOKS_CALLOUTS_BEGIN)
LOG_DEBUG(callouts_logger, HOOKS_DBG_CALLS, HOOKS_CALLOUTS_BEGIN)
.arg(server_hooks_.getName(current_hook_));
// Call all the callouts.
......@@ -157,13 +157,13 @@ CalloutManager::callCallouts(int hook_index, CalloutHandle& callout_handle) {
int status = (*i->second)(callout_handle);
stopwatch.stop();
if (status == 0) {
LOG_DEBUG(hooks_logger, HOOKS_DBG_EXTENDED_CALLS,
LOG_DEBUG(callouts_logger, HOOKS_DBG_EXTENDED_CALLS,
HOOKS_CALLOUT_CALLED).arg(current_library_)
.arg(server_hooks_.getName(current_hook_))
.arg(PointerConverter(i->second).dlsymPtr())
.arg(stopwatch.logFormatLastDuration());
} else {
LOG_ERROR(hooks_logger, HOOKS_CALLOUT_ERROR)
LOG_ERROR(callouts_logger, HOOKS_CALLOUT_ERROR)
.arg(current_library_)
.arg(server_hooks_.getName(current_hook_))
.arg(PointerConverter(i->second).dlsymPtr())
......@@ -174,7 +174,7 @@ CalloutManager::callCallouts(int hook_index, CalloutHandle& callout_handle) {
// called, so we have to call it here.
stopwatch.stop();
// Any exception, not just ones based on isc::Exception
LOG_ERROR(hooks_logger, HOOKS_CALLOUT_EXCEPTION)
LOG_ERROR(callouts_logger, HOOKS_CALLOUT_EXCEPTION)
.arg(current_library_)
.arg(server_hooks_.getName(current_hook_))
.arg(PointerConverter(i->second).dlsymPtr())
......@@ -186,7 +186,7 @@ CalloutManager::callCallouts(int hook_index, CalloutHandle& callout_handle) {
// Mark end of callout execution. Include the total execution
// time for callouts.
LOG_DEBUG(hooks_logger, HOOKS_DBG_CALLS, HOOKS_CALLOUTS_COMPLETE)
LOG_DEBUG(callouts_logger, HOOKS_DBG_CALLS, HOOKS_CALLOUTS_COMPLETE)
.arg(server_hooks_.getName(current_hook_))
.arg(stopwatch.logFormatTotalDuration());
......@@ -235,7 +235,7 @@ CalloutManager::deregisterCallout(const std::string& name, CalloutPtr callout) {
// Return an indication of whether anything was removed.
bool removed = initial_size != hook_vector_[hook_index].size();
if (removed) {
LOG_DEBUG(hooks_logger, HOOKS_DBG_EXTENDED_CALLS,
LOG_DEBUG(callouts_logger, HOOKS_DBG_EXTENDED_CALLS,
HOOKS_CALLOUT_DEREGISTERED).arg(current_library_).arg(name);
}
......@@ -270,7 +270,7 @@ CalloutManager::deregisterAllCallouts(const std::string& name) {
// Return an indication of whether anything was removed.
bool removed = initial_size != hook_vector_[hook_index].size();
if (removed) {
LOG_DEBUG(hooks_logger, HOOKS_DBG_EXTENDED_CALLS,
LOG_DEBUG(callouts_logger, HOOKS_DBG_EXTENDED_CALLS,
HOOKS_ALL_CALLOUTS_DEREGISTERED).arg(current_library_)
.arg(name);
}
......
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011,2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -12,15 +12,17 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
/// Defines the logger used by the NSAS
/// Defines the logger used by the Hooks
#include "hooks/hooks_log.h"
#include <hooks/hooks_log.h>
namespace isc {
namespace hooks {
isc::log::Logger hooks_logger("hooks");
isc::log::Logger callouts_logger("callouts");
} // namespace hooks
} // namespace isc
// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013,2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -44,6 +44,13 @@ const int HOOKS_DBG_EXTENDED_CALLS = DBGLVL_TRACE_DETAIL_DATA;
/// space.
extern isc::log::Logger hooks_logger;
/// @brief Callouts logger
///
/// This is the specialized logger used to log messages pertaining to the
/// callouts execution. In particular, it logs when the callout is invoked
/// and when it ends. It also logs the callout execution times.
extern isc::log::Logger callouts_logger;
} // namespace hooks
} // namespace isc
......
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