Browse Source

[trac744] Logging for static data source

Michal 'vorner' Vaner 14 years ago
parent
commit
96d1613a47
2 changed files with 19 additions and 0 deletions
  1. 12 0
      src/lib/datasrc/messagedef.mes
  2. 7 0
      src/lib/datasrc/static_datasrc.cc

+ 12 - 0
src/lib/datasrc/messagedef.mes

@@ -406,3 +406,15 @@ MEM_ADD_ZONE Adding zone '%s/%s'
 
 MEM_FIND_ZONE Looking for zone '%s'
 + Debug information. We're looking for a zone in the in-memory data source.
+
+STATIC_CREATE Creating the static datasource
++ Debug information. We're creating the static data source (the one holding
++ stuff like version.bind).
+
+STATIC_BAD_CLASS Static data source can handle CH only
++ For some reason, someone asked the static data source a query that is not in
++ the CH class.
+
+STATIC_FIND Looking for '%s/%s'
++ Debug information. We're looking for this resource record set in the static
++ data source.

+ 7 - 0
src/lib/datasrc/static_datasrc.cc

@@ -26,6 +26,7 @@
 
 #include <datasrc/data_source.h>
 #include <datasrc/static_datasrc.h>
+#include <datasrc/logger.h>
 
 using namespace std;
 using namespace isc::dns;
@@ -112,6 +113,7 @@ StaticDataSrcImpl::StaticDataSrcImpl() :
 }
 
 StaticDataSrc::StaticDataSrc() {
+    logger.debug(DBG_TRACE_BASIC, DATASRC_STATIC_CREATE);
     setClass(RRClass::CH());
     impl_ = new StaticDataSrcImpl;
 }
@@ -155,8 +157,13 @@ StaticDataSrc::findRRset(const Name& qname,
                          RRsetList& target, uint32_t& flags,
                          const Name* const zonename) const
 {
+    if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
+        logger.debug(DBG_TRACE_DATA, DATASRC_STATIC_FIND,
+                     qname.toText().c_str(), qtype.toText().c_str());
+    }
     flags = 0;
     if (qclass != getClass() && qclass != RRClass::ANY()) {
+        logger.error(DATASRC_STATIC_BAD_CLASS);
         return (ERROR);
     }