From: Christian Hofstaedtler Date: Mon, 3 Feb 2014 20:46:17 +0000 (+0100) Subject: Fix gsql query-logging not always working X-Git-Tag: rec-3.6.0-rc1~210^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb743bba09b28857c7372a2bcba3d4acc1e2de04;p=pdns Fix gsql query-logging not always working query-logging would only be taken into account after the first direct (DNS) query; getAllDomains and other calls before the first query would not get the logging. Problematic when the backend instances are short-lived. --- diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index 2c84899e2..8f8f816ca 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -786,8 +786,6 @@ void GSQLBackend::lookup(const QType &qtype,const string &qname, DNSPacket *pkt_ string format; char output[1024]; - d_db->setLog(::arg().mustDo("query-logging")); - string lcqname=toLower(qname); // lcqname=labelReverse(makeRelative(lcqname, "net")); diff --git a/pdns/backends/gsql/gsqlbackend.hh b/pdns/backends/gsql/gsqlbackend.hh index 7b2da843d..efc417512 100644 --- a/pdns/backends/gsql/gsqlbackend.hh +++ b/pdns/backends/gsql/gsqlbackend.hh @@ -1,6 +1,7 @@ #include #include #include "ssql.hh" +#include "pdns/arguments.hh" #include "../../namespaces.hh" @@ -20,6 +21,9 @@ public: void setDB(SSql *db) { d_db=db; + if (d_db) { + d_db->setLog(::arg().mustDo("query-logging")); + } } virtual string sqlEscape(const string &name);