From fc2e34e362690c4625e23619c8de90c02a328964 Mon Sep 17 00:00:00 2001 From: Charles-Henri Bruyand Date: Fri, 15 Oct 2021 16:11:45 +0200 Subject: [PATCH] rec: only initialize NOD logger if it might be used --- pdns/pdns_recursor.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 5f63ed0f9c..8b73770488 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -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 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; -- 2.47.2