]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: only initialize NOD logger if it might be used 10843/head
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Fri, 15 Oct 2021 14:11:45 +0000 (16:11 +0200)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Fri, 15 Oct 2021 14:11:45 +0000 (16:11 +0200)
pdns/pdns_recursor.cc

index 5f63ed0f9c4aa33aebf15177a972b19443e1d4bf..8b737704885b2287231efd65f65643f49ee8a9cf 100644 (file)
@@ -1606,7 +1606,10 @@ static void startDoResolve(void *p)
     bool addPaddingToResponse = false;
 #ifdef NOD_ENABLED
     bool hasUDR = false;
-    auto nodlogger = g_slog->withName("nod")->v(1)->withValues("qname", Logging::Loggable(dc->d_mdp.d_qname));
+    std::shared_ptr<Logr::Logger> nodlogger{nullptr};
+    if (g_udrEnabled || g_nodEnabled) {
+      nodlogger = g_slog->withName("nod")->v(1)->withValues("qname", Logging::Loggable(dc->d_mdp.d_qname));
+    }
 #endif /* NOD_ENABLED */
     DNSPacketWriter::optvect_t returnedEdnsOptions; // Here we stuff all the options for the return packet
     uint8_t ednsExtRCode = 0;