]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Logging: have a global g_log 6358/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 16 Mar 2018 08:33:07 +0000 (09:33 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Fri, 30 Mar 2018 07:58:19 +0000 (09:58 +0200)
109 files changed:
docs/appendices/backend-writers-guide.rst
modules/bindbackend/bindbackend2.cc
modules/bindbackend/binddnssec.cc
modules/geoipbackend/geoipbackend.cc
modules/geoipbackend/geoipinterface-mmdb.cc
modules/gmysqlbackend/gmysqlbackend.cc
modules/gmysqlbackend/smysql.cc
modules/godbcbackend/godbcbackend.cc
modules/godbcbackend/sodbc.cc
modules/goraclebackend/goraclebackend.cc
modules/goraclebackend/soracle.cc
modules/gpgsqlbackend/gpgsqlbackend.cc
modules/gpgsqlbackend/spgsql.cc
modules/gsqlite3backend/gsqlite3backend.cc
modules/ldapbackend/ldapauthenticator.cc
modules/ldapbackend/ldapbackend.cc
modules/lua2backend/lua2api2.hh
modules/lua2backend/lua2backend.cc
modules/luabackend/dnssec.cc
modules/luabackend/lua_functions.cc
modules/luabackend/luabackend.cc
modules/luabackend/luabackend.hh
modules/luabackend/master.cc
modules/luabackend/minimal.cc
modules/luabackend/reload.cc
modules/luabackend/slave.cc
modules/luabackend/supermaster.cc
modules/mydnsbackend/mydnsbackend.cc
modules/opendbxbackend/odbxbackend.cc
modules/opendbxbackend/odbxbackend.hh
modules/opendbxbackend/odbxprivate.cc
modules/oraclebackend/oraclebackend.cc
modules/pipebackend/pipebackend.cc
modules/randombackend/randombackend.cc
modules/remotebackend/httpconnector.cc
modules/remotebackend/pipeconnector.cc
modules/remotebackend/remotebackend.cc
modules/remotebackend/unixconnector.cc
modules/remotebackend/zmqconnector.cc
modules/tinydnsbackend/cdb.cc
modules/tinydnsbackend/tinydnsbackend.cc
pdns/arguments.cc
pdns/auth-carbon.cc
pdns/auth-packetcache.cc
pdns/auth-querycache.cc
pdns/backends/gsql/gsqlbackend.cc
pdns/common_startup.cc
pdns/communicator.cc
pdns/dbdnsseckeeper.cc
pdns/distributor.hh
pdns/dns.hh
pdns/dnsbackend.cc
pdns/dnsdist-carbon.cc
pdns/dnsdist.cc
pdns/dnspacket.cc
pdns/dnsproxy.cc
pdns/dnsreplay.cc
pdns/dnsscan.cc
pdns/dnssecsigner.cc
pdns/dynhandler.cc
pdns/dynlistener.cc
pdns/gss_context.cc
pdns/logger.cc
pdns/logger.hh
pdns/lua-auth4.cc
pdns/lua-base4.cc
pdns/lua-base4.hh
pdns/lua-recursor4.cc
pdns/lwres.cc
pdns/mastercommunicator.cc
pdns/nameserver.cc
pdns/notify.cc
pdns/nproxy.cc
pdns/packethandler.cc
pdns/pdns_recursor.cc
pdns/pdnsutil.cc
pdns/pkcs11signers.cc
pdns/randomhelper.cc
pdns/rec-carbon.cc
pdns/rec-lua-conf.cc
pdns/rec-snmp.cc
pdns/rec_channel_rec.cc
pdns/receiver.cc
pdns/recursor_cache.hh
pdns/recursordist/test-syncres_cc.cc
pdns/reczones.cc
pdns/remote_logger.cc
pdns/rfc2136handler.cc
pdns/rpzloader.cc
pdns/secpoll-auth.cc
pdns/secpoll-recursor.cc
pdns/serialtweaker.cc
pdns/signingpipe.cc
pdns/slavecommunicator.cc
pdns/ssqlite3.cc
pdns/stubresolver.cc
pdns/syncres.cc
pdns/tcpreceiver.cc
pdns/test-lua_auth4_cc.cc
pdns/tkey.cc
pdns/ueberbackend.cc
pdns/unix_semaphore.cc
pdns/unix_utility.cc
pdns/validate-recursor.cc
pdns/validate.cc
pdns/version.cc
pdns/webserver.cc
pdns/ws-auth.cc
pdns/ws-recursor.cc

index baffdbb1c82f81eceba6a518fc79ab39a033fb4a..3d7d7f0587c683785e3fc0325fd3951084caba4d 100644 (file)
@@ -203,7 +203,7 @@ furthermore, only about its A record:
       RandomLoader()
       {
         BackendMakers().report(new RandomFactory);
-        L << Logger::Info << "[randombackend] This is the random backend version " VERSION " reporting" << endl;
+        g_log << Logger::Info << "[randombackend] This is the random backend version " VERSION " reporting" << endl;
       }
     };
 
@@ -625,7 +625,7 @@ The actual code in PowerDNS is currently:
         resolver.axfr(remote,domain.c_str());
 
         db->startTransaction(domain, domain_id);
-        L<<Logger::Error<<"AXFR started for '"<<domain<<"'"<<endl;
+        g_log<<Logger::Error<<"AXFR started for '"<<domain<<"'"<<endl;
         Resolver::res_t recs;
 
         while(resolver.axfrChunk(recs)) {
@@ -635,7 +635,7 @@ The actual code in PowerDNS is currently:
         }
         db->commitTransaction();
         db->setFresh(domain_id);
-        L<<Logger::Error<<"AXFR done for '"<<domain<<"'"<<endl;
+        g_log<<Logger::Error<<"AXFR done for '"<<domain<<"'"<<endl;
 
 Supermaster/Superslave capability
 ---------------------------------
index ff645ad750ab12ef15f248985dea26ec3bff08e6..4baab252bd4b2308121d21e78498a4864db93169 100644 (file)
@@ -488,7 +488,7 @@ void Bind2Backend::insertRecord(BB2DomainInfo& bb2, const DNSName &qname, const
   else {
     string msg = "Trying to insert non-zone data, name='"+bdr.qname.toLogString()+"', qtype="+qtype.getName()+", zone='"+bb2.d_name.toLogString()+"'";
     if(s_ignore_broken_records) {
-        L<<Logger::Warning<<msg<< " ignored" << endl;
+        g_log<<Logger::Warning<<msg<< " ignored" << endl;
         return;
     }
     else
@@ -604,7 +604,7 @@ string Bind2Backend::DLAddDomainHandler(const vector<string>&parts, Utility::pid
 
   safePutBBDomainInfo(bbd);
 
-  L<<Logger::Warning<<"Zone "<<domainname<< " loaded"<<endl;
+  g_log<<Logger::Warning<<"Zone "<<domainname<< " loaded"<<endl;
   return "Loaded zone " + domainname.toLogString() + " from " + filename;
 }
 
@@ -737,7 +737,7 @@ void Bind2Backend::doEmptyNonTerminals(BB2DomainInfo& bbd, bool nsec3zone, NSEC3
       {
         if(!(maxent))
         {
-          L<<Logger::Error<<"Zone '"<<bbd.d_name<<"' has too many empty non terminals."<<endl;
+          g_log<<Logger::Error<<"Zone '"<<bbd.d_name<<"' has too many empty non terminals."<<endl;
           return;
         }
 
@@ -776,7 +776,7 @@ void Bind2Backend::loadConfig(string* status)
       BP.parse(getArg("config"));
     }
     catch(PDNSException &ae) {
-      L<<Logger::Error<<"Error parsing bind configuration: "<<ae.reason<<endl;
+      g_log<<Logger::Error<<"Error parsing bind configuration: "<<ae.reason<<endl;
       throw;
     }
       
@@ -786,7 +786,7 @@ void Bind2Backend::loadConfig(string* status)
     s_binddirectory=BP.getDirectory();
     //    ZP.setDirectory(d_binddirectory);
 
-    L<<Logger::Warning<<d_logprefix<<" Parsing "<<domains.size()<<" domain(s), will report when done"<<endl;
+    g_log<<Logger::Warning<<d_logprefix<<" Parsing "<<domains.size()<<" domain(s), will report when done"<<endl;
     
     set<DNSName> oldnames, newnames;
     {
@@ -814,15 +814,15 @@ void Bind2Backend::loadConfig(string* status)
         ++i) 
       {
         if (!(i->hadFileDirective)) {
-          L<<Logger::Warning<<d_logprefix<<" Zone '"<<i->name<<"' has no 'file' directive set in "<<getArg("config")<<endl;
+          g_log<<Logger::Warning<<d_logprefix<<" Zone '"<<i->name<<"' has no 'file' directive set in "<<getArg("config")<<endl;
           rejected++;
           continue;
         }
 
         if(i->type == "")
-          L<<Logger::Notice<<d_logprefix<<" Zone '"<<i->name<<"' has no type specified, assuming 'native'"<<endl;
+          g_log<<Logger::Notice<<d_logprefix<<" Zone '"<<i->name<<"' has no type specified, assuming 'native'"<<endl;
         if(i->type!="master" && i->type!="slave" && i->type != "native" && i->type != "") {
-          L<<Logger::Warning<<d_logprefix<<" Warning! Skipping zone '"<<i->name<<"' because type '"<<i->type<<"' is invalid"<<endl;
+          g_log<<Logger::Warning<<d_logprefix<<" Warning! Skipping zone '"<<i->name<<"' because type '"<<i->type<<"' is invalid"<<endl;
           rejected++;
           continue;
         }
@@ -853,7 +853,7 @@ void Bind2Backend::loadConfig(string* status)
 
         newnames.insert(bbd.d_name);
         if(filenameChanged || !bbd.d_loaded || !bbd.current()) {
-          L<<Logger::Info<<d_logprefix<<" parsing '"<<i->name<<"' from file '"<<i->filename<<"'"<<endl;
+          g_log<<Logger::Info<<d_logprefix<<" parsing '"<<i->name<<"' from file '"<<i->filename<<"'"<<endl;
 
           try {
             parseZoneFile(&bbd);
@@ -866,7 +866,7 @@ void Bind2Backend::loadConfig(string* status)
               *status+=msg.str();
            bbd.d_status=msg.str();
 
-            L<<Logger::Warning<<d_logprefix<<msg.str()<<endl;
+            g_log<<Logger::Warning<<d_logprefix<<msg.str()<<endl;
             rejected++;
           }
           catch(std::system_error &ae) {
@@ -879,7 +879,7 @@ void Bind2Backend::loadConfig(string* status)
             if(status)
               *status+=msg.str();
             bbd.d_status=msg.str();
-            L<<Logger::Warning<<d_logprefix<<msg.str()<<endl;
+            g_log<<Logger::Warning<<d_logprefix<<msg.str()<<endl;
             rejected++;
           }
           catch(std::exception &ae) {
@@ -890,7 +890,7 @@ void Bind2Backend::loadConfig(string* status)
               *status+=msg.str();
             bbd.d_status=msg.str();
 
-            L<<Logger::Warning<<d_logprefix<<msg.str()<<endl;
+            g_log<<Logger::Warning<<d_logprefix<<msg.str()<<endl;
             rejected++;
           }
          safePutBBDomainInfo(bbd);
@@ -916,7 +916,7 @@ void Bind2Backend::loadConfig(string* status)
     if(status)
       *status=msg.str();
 
-    L<<Logger::Error<<d_logprefix<<msg.str()<<endl;
+    g_log<<Logger::Error<<d_logprefix<<msg.str()<<endl;
   }
 }
 
@@ -931,12 +931,12 @@ void Bind2Backend::queueReloadAndStore(unsigned int id)
     bbnew.d_checknow=false;
     bbnew.d_wasRejectedLastReload=false;
     safePutBBDomainInfo(bbnew);
-    L<<Logger::Warning<<"Zone '"<<bbnew.d_name<<"' ("<<bbnew.d_filename<<") reloaded"<<endl;
+    g_log<<Logger::Warning<<"Zone '"<<bbnew.d_name<<"' ("<<bbnew.d_filename<<") reloaded"<<endl;
   }
   catch(PDNSException &ae) {
     ostringstream msg;
     msg<<" error at "+nowTime()+" parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.reason;
-    L<<Logger::Warning<<" error parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.reason<<endl;
+    g_log<<Logger::Warning<<" error parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.reason<<endl;
     bbold.d_status=msg.str();
     bbold.d_wasRejectedLastReload=true;
     safePutBBDomainInfo(bbold);
@@ -944,7 +944,7 @@ void Bind2Backend::queueReloadAndStore(unsigned int id)
   catch(std::exception &ae) {
     ostringstream msg;
     msg<<" error at "+nowTime()+" parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.what();
-    L<<Logger::Warning<<" error parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.what()<<endl;
+    g_log<<Logger::Warning<<" error parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.what()<<endl;
     bbold.d_status=msg.str();
     bbold.d_wasRejectedLastReload=true;
     safePutBBDomainInfo(bbold);
@@ -1036,7 +1036,7 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
 
   static bool mustlog=::arg().mustDo("query-logging");
   if(mustlog) 
-    L<<Logger::Warning<<"Lookup for '"<<qtype.getName()<<"' of '"<<domain<<"' within zoneID "<<zoneId<<endl;
+    g_log<<Logger::Warning<<"Lookup for '"<<qtype.getName()<<"' of '"<<domain<<"' within zoneID "<<zoneId<<endl;
   bool found=false;
   BB2DomainInfo bbd;
 
@@ -1046,17 +1046,17 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
 
   if(!found) {
     if(mustlog)
-      L<<Logger::Warning<<"Found no authoritative zone for "<<qname<<endl;
+      g_log<<Logger::Warning<<"Found no authoritative zone for "<<qname<<endl;
     d_handle.d_list=false;
     return;
   }
 
   if(mustlog)
-    L<<Logger::Warning<<"Found a zone '"<<domain<<"' (with id " << bbd.d_id<<") that might contain data "<<endl;
+    g_log<<Logger::Warning<<"Found a zone '"<<domain<<"' (with id " << bbd.d_id<<") that might contain data "<<endl;
     
   d_handle.id=bbd.d_id;
   
-  DLOG(L<<"Bind2Backend constructing handle for search for "<<qtype.getName()<<" for "<<
+  DLOG(g_log<<"Bind2Backend constructing handle for search for "<<qtype.getName()<<" for "<<
        qname<<endl);
   
   if(domain.empty())
@@ -1073,7 +1073,7 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
   }
     
   if(!bbd.current()) {
-    L<<Logger::Warning<<"Zone '"<<bbd.d_name<<"' ("<<bbd.d_filename<<") needs reloading"<<endl;
+    g_log<<Logger::Warning<<"Zone '"<<bbd.d_name<<"' ("<<bbd.d_filename<<") needs reloading"<<endl;
     queueReloadAndStore(bbd.d_id);
     if (!safeGetBBDomainInfo(domain, &bbd))
       throw DBException("Zone '"+bbd.d_name.toLogString()+"' ("+bbd.d_filename+") gone after reload"); // if we don't throw here, we crash for some reason
@@ -1082,7 +1082,7 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
   d_handle.d_records = bbd.d_records.get();
   
   if(d_handle.d_records->empty())
-    DLOG(L<<"Query with no results"<<endl);
+    DLOG(g_log<<"Query with no results"<<endl);
 
   d_handle.mustlog = mustlog;
 
@@ -1111,20 +1111,20 @@ bool Bind2Backend::get(DNSResourceRecord &r)
 {
   if(!d_handle.d_records) {
     if(d_handle.mustlog)
-      L<<Logger::Warning<<"There were no answers"<<endl;
+      g_log<<Logger::Warning<<"There were no answers"<<endl;
     return false;
   }
 
   if(!d_handle.get(r)) {
     if(d_handle.mustlog)
-      L<<Logger::Warning<<"End of answers"<<endl;
+      g_log<<Logger::Warning<<"End of answers"<<endl;
 
     d_handle.reset();
 
     return false;
   }
   if(d_handle.mustlog)
-    L<<Logger::Warning<<"Returning: '"<<r.qtype.getName()<<"' of '"<<r.qname<<"', content: '"<<r.content<<"'"<<endl;
+    g_log<<Logger::Warning<<"Returning: '"<<r.qtype.getName()<<"' of '"<<r.qname<<"', content: '"<<r.content<<"'"<<endl;
   return true;
 }
 
@@ -1146,7 +1146,7 @@ void Bind2Backend::handle::reset()
 //#define DLOG(x) x
 bool Bind2Backend::handle::get_normal(DNSResourceRecord &r)
 {
-  DLOG(L << "Bind2Backend get() was called for "<<qtype.getName() << " record for '"<<
+  DLOG(g_log << "Bind2Backend get() was called for "<<qtype.getName() << " record for '"<<
        qname<<"' - "<<d_records->size()<<" available in total!"<<endl);
   
   if(d_iter==d_end_iter) {
@@ -1154,13 +1154,13 @@ bool Bind2Backend::handle::get_normal(DNSResourceRecord &r)
   }
 
   while(d_iter!=d_end_iter && !(qtype.getCode()==QType::ANY || (d_iter)->qtype==qtype.getCode())) {
-    DLOG(L<<Logger::Warning<<"Skipped "<<qname<<"/"<<QType(d_iter->qtype).getName()<<": '"<<d_iter->content<<"'"<<endl);
+    DLOG(g_log<<Logger::Warning<<"Skipped "<<qname<<"/"<<QType(d_iter->qtype).getName()<<": '"<<d_iter->content<<"'"<<endl);
     d_iter++;
   }
   if(d_iter==d_end_iter) {
     return false;
   }
-  DLOG(L << "Bind2Backend get() returning a rr with a "<<QType(d_iter->qtype).getCode()<<endl);
+  DLOG(g_log << "Bind2Backend get() returning a rr with a "<<QType(d_iter->qtype).getCode()<<endl);
 
   r.qname=qname.empty() ? domain : (qname+domain);
   r.domain_id=id;
@@ -1186,7 +1186,7 @@ bool Bind2Backend::list(const DNSName& target, int id, bool include_disabled)
     return false;
 
   d_handle.reset(); 
-  DLOG(L<<"Bind2Backend constructing handle for list of "<<id<<endl);
+  DLOG(g_log<<"Bind2Backend constructing handle for list of "<<id<<endl);
 
   d_handle.d_records=bbd.d_records.get(); // give it a copy, which will stay around
   d_handle.d_qname_iter= d_handle.d_records->begin();
@@ -1237,7 +1237,7 @@ bool Bind2Backend::superMasterBackend(const string &ip, const DNSName& domain, c
 
   ifstream c_if(getArg("supermasters").c_str(), std::ios::in); // this was nocreate?
   if (!c_if) {
-    L << Logger::Error << "Unable to open supermasters file for read: " << stringerror() << endl;
+    g_log << Logger::Error << "Unable to open supermasters file for read: " << stringerror() << endl;
     return false;
   }
 
@@ -1288,7 +1288,7 @@ bool Bind2Backend::createSlaveDomain(const string &ip, const DNSName& domain, co
 {
   string filename = getArg("supermaster-destdir")+'/'+domain.toStringNoDot();
   
-  L << Logger::Warning << d_logprefix
+  g_log << Logger::Warning << d_logprefix
     << " Writing bind config zone statement for superslave zone '" << domain
     << "' from supermaster " << ip << endl;
 
@@ -1297,7 +1297,7 @@ bool Bind2Backend::createSlaveDomain(const string &ip, const DNSName& domain, co
         
     ofstream c_of(getArg("supermaster-config").c_str(),  std::ios::app);
     if (!c_of) {
-      L << Logger::Error << "Unable to open supermaster configfile for append: " << stringerror() << endl;
+      g_log << Logger::Error << "Unable to open supermaster configfile for append: " << stringerror() << endl;
       throw DBException("Unable to open supermaster configfile for append: "+stringerror());
     }
     
@@ -1323,7 +1323,7 @@ bool Bind2Backend::searchRecords(const string &pattern, int maxResults, vector<D
   SimpleMatch sm(pattern,true);
   static bool mustlog=::arg().mustDo("query-logging");
   if(mustlog)
-    L<<Logger::Warning<<"Search for pattern '"<<pattern<<"'"<<endl;
+    g_log<<Logger::Warning<<"Search for pattern '"<<pattern<<"'"<<endl;
 
   {
     ReadLock rl(&s_state_lock);
@@ -1387,7 +1387,7 @@ public:
   Bind2Loader()
   {
     BackendMakers().report(new Bind2Factory);
-    L << Logger::Info << "[bind2backend] This is the bind backend version " << VERSION
+    g_log << Logger::Info << "[bind2backend] This is the bind backend version " << VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index df005ac9c38299ad17e870ec42a6c28a7ab90820..f254ec5c7a445556db20dbc641039458e50bc08b 100644 (file)
@@ -173,11 +173,11 @@ bool Bind2Backend::getNSEC3PARAM(const DNSName& name, NSEC3PARAMRecordContent* n
 
     if (ns3p->d_iterations > maxNSEC3Iterations) {
       ns3p->d_iterations = maxNSEC3Iterations;
-      L<<Logger::Error<<"Number of NSEC3 iterations for zone '"<<name<<"' is above 'max-nsec3-iterations'. Value adjusted to: "<<maxNSEC3Iterations<<endl;
+      g_log<<Logger::Error<<"Number of NSEC3 iterations for zone '"<<name<<"' is above 'max-nsec3-iterations'. Value adjusted to: "<<maxNSEC3Iterations<<endl;
     }
 
     if (ns3p->d_algorithm != 1) {
-      L<<Logger::Error<<"Invalid hash algorithm for NSEC3: '"<<std::to_string(ns3p->d_algorithm)<<"', setting to 1 for zone '"<<name<<"'."<<endl;
+      g_log<<Logger::Error<<"Invalid hash algorithm for NSEC3: '"<<std::to_string(ns3p->d_algorithm)<<"', setting to 1 for zone '"<<name<<"'."<<endl;
       ns3p->d_algorithm = 1;
     }
   }
index 58d662099ea495d4bfec6c23561fe5693b9602a6..1953da6cdf285d43017be98410e2be1bae7c1960 100644 (file)
@@ -99,7 +99,7 @@ void GeoIPBackend::initialize() {
   }
 
   if (s_geoip_files.empty())
-    L<<Logger::Warning<<"No GeoIP database files loaded!"<<endl;
+    g_log<<Logger::Warning<<"No GeoIP database files loaded!"<<endl;
 
   config = YAML::LoadFile(getArg("zones-file"));
 
@@ -138,14 +138,14 @@ void GeoIPBackend::initialize() {
              } else if (attr == "weight") {
                rr.weight = iter->second.as<int>();
                if (rr.weight < 0) {
-                 L<<Logger::Error<<"Weight cannot be negative for " << rr.qname << endl;
+                 g_log<<Logger::Error<<"Weight cannot be negative for " << rr.qname << endl;
                  throw PDNSException(string("Weight cannot be negative for ") + rr.qname.toLogString());
                }
                rr.has_weight = true;
              } else if (attr == "ttl") {
                rr.ttl = iter->second.as<int>();
              } else {
-               L<<Logger::Error<<"Unsupported record attribute " << attr << " for " << rr.qname << endl;
+               g_log<<Logger::Error<<"Unsupported record attribute " << attr << " for " << rr.qname << endl;
                throw PDNSException(string("Unsupported record attribute ") + attr + string(" for ") + rr.qname.toLogString());
              }
            }
@@ -367,7 +367,7 @@ void GeoIPBackend::lookup(const QType &qtype, const DNSName& qdomain, DNSPacket
   }
 
   if (!d_result.empty()) {
-    L<<Logger::Error<<
+    g_log<<Logger::Error<<
        "Cannot have static record and CNAME at the same time." <<
        "Please fix your configuration for \"" << qdomain << "\", so that " <<
        "it can be resolved by GeoIP backend directly."<< std::endl;
@@ -590,11 +590,11 @@ void GeoIPBackend::reload() {
   try {
     initialize();
   } catch (PDNSException &pex) {
-    L<<Logger::Error<<"GeoIP backend reload failed: " << pex.reason << endl;
+    g_log<<Logger::Error<<"GeoIP backend reload failed: " << pex.reason << endl;
   } catch (std::exception &stex) {
-    L<<Logger::Error<<"GeoIP backend reload failed: " << stex.what() << endl;
+    g_log<<Logger::Error<<"GeoIP backend reload failed: " << stex.what() << endl;
   } catch (...) {
-    L<<Logger::Error<<"GeoIP backend reload failed" << endl;
+    g_log<<Logger::Error<<"GeoIP backend reload failed" << endl;
   }
 }
 
@@ -861,7 +861,7 @@ class GeoIPLoader {
 public:
   GeoIPLoader() {
     BackendMakers().report(new GeoIPFactory);
-    L << Logger::Info << "[geoipbackend] This is the geoip backend version " VERSION
+    g_log << Logger::Info << "[geoipbackend] This is the geoip backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index 1cb48c6e00b25aeba679cce4e9fb558528eb3f33..44cb98a3243301a07f7358461ce4f124b3b12d43 100644 (file)
@@ -47,7 +47,7 @@ public:
     if ((ec = MMDB_open(fname.c_str(), flags, &d_s)) < 0)
       throw PDNSException(string("Cannot open ") + fname + string(": ") + string(MMDB_strerror(ec)));
     d_lang = language;
-    L<<Logger::Debug<<"Opened MMDB database "<<fname<<"(type: "<<d_s.metadata.database_type<<
+    g_log<<Logger::Debug<<"Opened MMDB database "<<fname<<"(type: "<<d_s.metadata.database_type<<
                       " version: "<<d_s.metadata.binary_format_major_version << "." <<
                       d_s.metadata.binary_format_minor_version << ")" << endl;
   }
@@ -242,9 +242,9 @@ private:
     res = MMDB_lookup_string(&d_s, ip.c_str(), &gai_ec, &mmdb_ec);
  
     if (gai_ec != 0)
-      L<<Logger::Warning<<"MMDB_lookup_string("<<ip<<") failed: "<<gai_strerror(gai_ec)<<endl;
+      g_log<<Logger::Warning<<"MMDB_lookup_string("<<ip<<") failed: "<<gai_strerror(gai_ec)<<endl;
     else if (mmdb_ec != MMDB_SUCCESS)
-      L<<Logger::Warning<<"MMDB_lookup_string("<<ip<<") failed: "<<MMDB_strerror(mmdb_ec)<<endl;
+      g_log<<Logger::Warning<<"MMDB_lookup_string("<<ip<<") failed: "<<MMDB_strerror(mmdb_ec)<<endl;
     else if (res.found_entry) {
       gl.netmask = res.netmask;
       /* If it's a IPv6 database, IPv4 netmasks are reduced from 128, so we need to deduct
index c5b85b7d2e8bcc00913debf330db687d3aff0c4e..ff75d94ff2aabc9570ea53ab08fb6a5e59277fbb 100644 (file)
@@ -43,10 +43,10 @@ gMySQLBackend::gMySQLBackend(const string &mode, const string &suffix)  : GSQLBa
   }
 
   catch(SSqlException &e) {
-    L<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
+    g_log<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
     throw PDNSException("Unable to launch "+mode+" connection: "+e.txtReason());
   }
-  L<<Logger::Info<<mode<<" Connection successful. Connected to database '"<<getArg("dbname")<<"' on '"<<(getArg("host").empty() ? getArg("socket") : getArg("host"))<<"'."<<endl;
+  g_log<<Logger::Info<<mode<<" Connection successful. Connected to database '"<<getArg("dbname")<<"' on '"<<(getArg("host").empty() ? getArg("socket") : getArg("host"))<<"'."<<endl;
 }
 
 void gMySQLBackend::reconnect()
@@ -173,7 +173,7 @@ public:
   gMySQLLoader()
   {
     BackendMakers().report(new gMySQLFactory("gmysql"));
-    L << Logger::Info << "[gmysqlbackend] This is the gmysql backend version " VERSION
+    g_log << Logger::Info << "[gmysqlbackend] This is the gmysql backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index 8a2a5092a3fc9c41c43dbc350289a477365cdb09..4fee28f6bfccaacb921adba21bc495bc658e5a1d 100644 (file)
@@ -156,7 +156,7 @@ public:
     if (!d_stmt) return this;
 
     if (d_dolog) {
-      L<<Logger::Warning<<"Query: " << d_query <<endl;
+      g_log<<Logger::Warning<<"Query: " << d_query <<endl;
     }
 
     if ((err = mysql_stmt_bind_param(d_stmt, d_req_bind))) {
@@ -241,7 +241,7 @@ public:
 
     for(int i=0;i<d_fnum;i++) {
       if (err == MYSQL_DATA_TRUNCATED && *d_res_bind[i].error) {
-        L<<Logger::Warning<<"Result field at row " << d_residx << " column " << i << " has been truncated, we allocated " << d_res_bind[i].buffer_length << " bytes but at least " << *d_res_bind[i].length << " was needed" << endl;
+        g_log<<Logger::Warning<<"Result field at row " << d_residx << " column " << i << " has been truncated, we allocated " << d_res_bind[i].buffer_length << " bytes but at least " << *d_res_bind[i].length << " was needed" << endl;
       }
       if (*d_res_bind[i].is_null) {
         row.push_back("");
@@ -482,7 +482,7 @@ std::unique_ptr<SSqlStatement> SMySQL::prepare(const string& query, int nparams)
 void SMySQL::execute(const string& query)
 {
   if(s_dolog)
-    L<<Logger::Warning<<"Query: "<<query<<endl;
+    g_log<<Logger::Warning<<"Query: "<<query<<endl;
 
   int err;
   if((err=mysql_query(&d_db,query.c_str())))
index 0f4e9aad991c88f3e5391b4d74bc1c68e18c77ad..b1dff9bafc5c42ea086ed249f4dcedc132fb5a17 100644 (file)
@@ -43,11 +43,11 @@ gODBCBackend::gODBCBackend (const std::string & mode, const std::string & suffix
   }
   catch( SSqlException & e )
   {
-    L<<Logger::Error<< mode << " Connection failed: " << e.txtReason() << std::endl;
+    g_log<<Logger::Error<< mode << " Connection failed: " << e.txtReason() << std::endl;
     throw PDNSException( "Unable to launch " + mode + " connection: " + e.txtReason());
   }
 
-  L << Logger::Warning << mode << " Connection successful" << std::endl;
+  g_log << Logger::Warning << mode << " Connection successful" << std::endl;
 }
 
 
@@ -165,7 +165,7 @@ public:
   gODBCLoader()
   {
     BackendMakers().report( new gODBCFactory("godbc"));
-    L<<Logger::Warning << "This is module godbcbackend reporting" << std::endl;
+    g_log<<Logger::Warning << "This is module godbcbackend reporting" << std::endl;
   }
 };
 
index db1dfccb00b08b156eb1f2a448a39cf69acb3bef..5b8e45843f3459228541c0d42c9ca3b47717330b 100644 (file)
@@ -189,7 +189,7 @@ public:
     SQLRETURN result;
     // cerr<<"execute("<<d_query<<")"<<endl;
     if (d_dolog) {
-      L<<Logger::Warning<<"Query: "<<d_query<<endl;
+      g_log<<Logger::Warning<<"Query: "<<d_query<<endl;
     }
 
     result = SQLExecute(d_statement);
index 2c9bde29ec37ca7c6e22267ea54c8277e55c9676..a49cea32bbf04a9776177f3d07a162acb7ddca18 100644 (file)
@@ -64,10 +64,10 @@ gOracleBackend::gOracleBackend(const string &mode, const string &suffix)  : GSQL
   }
 
   catch (SSqlException &e) {
-    L<<Logger::Error << mode << " Connection failed: " << e.txtReason() << endl;
+    g_log<<Logger::Error << mode << " Connection failed: " << e.txtReason() << endl;
     throw PDNSException("Unable to launch " + mode + " connection: " + e.txtReason());
   }
-  L<<Logger::Info << mode << " Connection successful" << endl;
+  g_log<<Logger::Info << mode << " Connection successful" << endl;
 }
 
 class gOracleFactory : public BackendFactory
@@ -177,7 +177,7 @@ public:
   //! This reports us to the main UeberBackend class
   gOracleLoader() {
     BackendMakers().report(new gOracleFactory("goracle"));
-    L << Logger::Info << "[goraclebackend] This is the goracle backend version " VERSION
+    g_log << Logger::Info << "[goraclebackend] This is the goracle backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index e5f4a8b93e0d28e83c1f5bc33a7a02aaa623dfc9..fdf01cacaf2b28472bcf3e50b4d306aa76fe1c61 100644 (file)
@@ -178,7 +178,7 @@ public:
     prepareStatement();
 
     if (d_dolog)
-      L<<Logger::Warning<<"Query: "<<d_query<<endl;
+      g_log<<Logger::Warning<<"Query: "<<d_query<<endl;
     ub2 fntype;
     ub4 iters;
 
@@ -496,7 +496,7 @@ SOracle::~SOracle()
   if (d_serviceContextHandle != NULL) {
     err=OCILogoff(d_serviceContextHandle, d_errorHandle);
     if (err) {
-      L<<Logger::Warning<<"Problems logging out: "+getOracleError()<<endl;
+      g_log<<Logger::Warning<<"Problems logging out: "+getOracleError()<<endl;
     }
   }
 
index 473b5079ede9683d5ded5456bc5e0f560fde2d79..5396878b9f3dc5f3717e2375f9ea58c0c1759d20 100644 (file)
@@ -48,10 +48,10 @@ gPgSQLBackend::gPgSQLBackend(const string &mode, const string &suffix)  : GSQLBa
   }
 
   catch(SSqlException &e) {
-    L<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
+    g_log<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
     throw PDNSException("Unable to launch "+mode+" connection: "+e.txtReason());
   }
-  L<<Logger::Info<<mode<<" Connection successful. Connected to database '"<<getArg("dbname")<<"' on '"<<getArg("host")<<"'."<<endl;
+  g_log<<Logger::Info<<mode<<" Connection successful. Connected to database '"<<getArg("dbname")<<"' on '"<<getArg("host")<<"'."<<endl;
 }
 
 void gPgSQLBackend::reconnect()
@@ -181,7 +181,7 @@ public:
   gPgSQLLoader()
   {
     BackendMakers().report(new gPgSQLFactory("gpgsql"));
-    L << Logger::Info << "[gpgsqlbackend] This is the gpgsql backend version " VERSION
+    g_log << Logger::Info << "[gpgsqlbackend] This is the gpgsql backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index 10fb8c7dfb4161fa66013569a459aa536a6c26c5..cfd23615925992741d1944dabe9249f4239a916a 100644 (file)
@@ -78,7 +78,7 @@ public:
   SSqlStatement* execute() {
     prepareStatement();
     if (d_dolog) {
-      L<<Logger::Warning<<"Query: "<<d_query<<endl;
+      g_log<<Logger::Warning<<"Query: "<<d_query<<endl;
     }
     d_res_set = PQexecPrepared(d_db(), d_stmt.c_str(), d_nparams, paramValues, paramLengths, NULL, 0);
     ExecStatusType status = PQresultStatus(d_res_set);
@@ -115,7 +115,7 @@ public:
 #endif
       // execute FETCH
       if (d_dolog)
-         L<<Logger::Warning<<"Query: "<<cmd<<endl;
+         g_log<<Logger::Warning<<"Query: "<<cmd<<endl;
       d_res = PQexec(d_db(),cmd.c_str());
       d_resnum = PQntuples(d_res);
       d_fnum = PQnfields(d_res);
index dd1bdc8ca4fc3ec181b27c4b54a4c032dc700146..4051f91848eeb949462e8033cb68089abc651f38 100644 (file)
@@ -54,11 +54,11 @@ gSQLite3Backend::gSQLite3Backend( const std::string & mode, const std::string &
   }  
   catch( SSqlException & e ) 
   {
-    L << Logger::Error << mode << ": connection failed: " << e.txtReason() << std::endl;
+    g_log << Logger::Error << mode << ": connection failed: " << e.txtReason() << std::endl;
     throw PDNSException( "Unable to launch " + mode + " connection: " + e.txtReason());
   }
 
-  L << Logger::Info << mode << ": connection to '"<<getArg("database")<<"' successful" << std::endl;
+  g_log << Logger::Info << mode << ": connection to '"<<getArg("database")<<"' successful" << std::endl;
 }
 
 
@@ -174,7 +174,7 @@ public:
   gSQLite3Loader()
   {
     BackendMakers().report( new gSQLite3Factory( "gsqlite3" ));
-    L << Logger::Info << "[gsqlite3] This is the gsqlite3 backend version " VERSION
+    g_log << Logger::Info << "[gsqlite3] This is the gsqlite3 backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index c2fa875c206ad9e7f975056a394ee2d31a618c79..12a43fd202c9c977b014f2ea7059c23f268307a8 100644 (file)
@@ -96,11 +96,11 @@ bool LdapGssapiAuthenticator::authenticate( LDAP *conn )
   }
   else if ( code == -2 ) {
     // Here it may be possible to retry after obtainting a fresh ticket
-    L<<Logger::Debug << logPrefix << "No TGT found, trying to acquire a new one" << std::endl;
+    g_log<<Logger::Debug << logPrefix << "No TGT found, trying to acquire a new one" << std::endl;
     code = updateTgt();
 
     if ( attemptAuth( conn ) != 0 ) {
-      L<<Logger::Error << logPrefix << "Failed to acquire a TGT" << std::endl;
+      g_log<<Logger::Error << logPrefix << "Failed to acquire a TGT" << std::endl;
       return false;
     }
   }
@@ -145,7 +145,7 @@ int LdapGssapiAuthenticator::attemptAuth( LDAP *conn )
   int rc = ldap_sasl_interactive_bind_s( conn, "", defaults.mech.c_str(),
                                          NULL, NULL, LDAP_SASL_QUIET,
                                          ldapGssapiAuthenticatorSaslInteractCallback, &defaults );
-  L<<Logger::Debug << logPrefix << "ldap_sasl_interactive_bind_s returned " << rc << std::endl;
+  g_log<<Logger::Debug << logPrefix << "ldap_sasl_interactive_bind_s returned " << rc << std::endl;
 
   if ( rc == LDAP_LOCAL_ERROR ) {
     // This may mean that the ticket has expired, so let the caller know
@@ -171,7 +171,7 @@ int LdapGssapiAuthenticator::updateTgt()
   krb5_get_init_creds_opt *options;
 
   if ( ( code = krb5_init_context( &context ) ) != 0 ) {
-    L<<Logger::Error << logPrefix << "Failed to init krb5 context" << std::endl;
+    g_log<<Logger::Error << logPrefix << "Failed to init krb5 context" << std::endl;
     return code;
   }
 
@@ -184,14 +184,14 @@ int LdapGssapiAuthenticator::updateTgt()
   }
   
   if ( code != 0 ) {
-    L<<Logger::Error << logPrefix << "krb5 error when locating the keytab file: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
+    g_log<<Logger::Error << logPrefix << "krb5 error when locating the keytab file: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
     return code;
   }
 
   // Extract the principal name from the keytab
   krb5_kt_cursor cursor;
   if ( ( code = krb5_kt_start_seq_get( context, keytab, &cursor ) ) != 0 ) {
-    L<<Logger::Error << logPrefix << "krb5 error when initiating keytab search: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
+    g_log<<Logger::Error << logPrefix << "krb5 error when initiating keytab search: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
     krb5_kt_close( context, keytab );
     return code;
   }
@@ -204,7 +204,7 @@ int LdapGssapiAuthenticator::updateTgt()
 
   krb5_kt_end_seq_get( context, keytab, &cursor );
   if ( code != 0 ) {
-    L<<Logger::Error << logPrefix << "krb5 error when extracting principal information: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
+    g_log<<Logger::Error << logPrefix << "krb5 error when extracting principal information: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
     krb5_kt_close( context, keytab );
     krb5_free_principal( context, principal );
     return code;
@@ -220,7 +220,7 @@ int LdapGssapiAuthenticator::updateTgt()
   }
 
   if ( code != 0 ) {
-    L<<Logger::Error << logPrefix << "krb5 error when locating the credentials cache file: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
+    g_log<<Logger::Error << logPrefix << "krb5 error when locating the credentials cache file: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
     krb5_kt_close( context, keytab );
     krb5_free_principal( context, principal );
     return code;
@@ -228,14 +228,14 @@ int LdapGssapiAuthenticator::updateTgt()
 
   // Initialize the credentials cache file
   if ( ( code = krb5_cc_initialize( context, ccache, principal ) ) != 0 ) {
-    L<<Logger::Error << logPrefix << "krb5 error when initializing the credentials cache file: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
+    g_log<<Logger::Error << logPrefix << "krb5 error when initializing the credentials cache file: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
     krb5_kt_close( context, keytab );
     krb5_free_principal( context, principal );
     return code;
   }
 
   if ( ( code = krb5_get_init_creds_opt_alloc( context, &options ) ) != 0 ) {
-    L<<Logger::Error << logPrefix << "krb5 error when allocating credentials cache structure: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
+    g_log<<Logger::Error << logPrefix << "krb5 error when allocating credentials cache structure: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
     krb5_kt_close( context, keytab );
     krb5_free_principal( context, principal );
     return code;
@@ -249,7 +249,7 @@ int LdapGssapiAuthenticator::updateTgt()
   krb5_free_principal( context, principal );
 
   if ( code == 0 ) {
-    L<<Logger::Error << logPrefix << "krb5 error when getting the TGT: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
+    g_log<<Logger::Error << logPrefix << "krb5 error when getting the TGT: " << std::string( krb5_get_error_message( context, code ) ) << std::endl;
     code = krb5_cc_store_cred( context, ccache, &credentials );
     krb5_free_cred_contents( context, &credentials );
     krb5_cc_close( context, ccache );
index 2998387a3f9659c3041218be71c42878f3677ff1..723dba1d6f0110c46f46bbd4cbb2ea306ef5ef43 100644 (file)
@@ -79,7 +79,7 @@ LdapBackend::LdapBackend( const string &suffix )
       hoststr += " " + hosts[ ( idx + i ) % hosts.size() ];
     }
 
-    L << Logger::Info << m_myname << " LDAP servers = " << hoststr << endl;
+    g_log << Logger::Info << m_myname << " LDAP servers = " << hoststr << endl;
 
     m_pldap = new PowerLDAP( hoststr.c_str(), LDAP_PORT, mustDo( "starttls" ), getArgAsNum( "timeout" ) );
     m_pldap->setOption( LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS );
@@ -94,20 +94,20 @@ LdapBackend::LdapBackend( const string &suffix )
     }
     m_pldap->bind( m_authenticator );
 
-    L << Logger::Notice << m_myname << " Ldap connection succeeded" << endl;
+    g_log << Logger::Notice << m_myname << " Ldap connection succeeded" << endl;
     return;
   }
   catch( LDAPTimeout &lt )
   {
-    L << Logger::Error << m_myname << " Ldap connection to server failed because of timeout" << endl;
+    g_log << Logger::Error << m_myname << " Ldap connection to server failed because of timeout" << endl;
   }
   catch( LDAPException &le )
   {
-    L << Logger::Error << m_myname << " Ldap connection to server failed: " << le.what() << endl;
+    g_log << Logger::Error << m_myname << " Ldap connection to server failed: " << le.what() << endl;
   }
   catch( std::exception &e )
   {
-    L << Logger::Error << m_myname << " Caught STL exception: " << e.what() << endl;
+    g_log << Logger::Error << m_myname << " Caught STL exception: " << e.what() << endl;
   }
 
   if( m_pldap != NULL ) { delete( m_pldap ); }
@@ -120,7 +120,7 @@ LdapBackend::~LdapBackend()
 {
   delete( m_pldap );
   delete( m_authenticator );
-  L << Logger::Notice << m_myname << " Ldap connection closed" << endl;
+  g_log << Logger::Notice << m_myname << " Ldap connection closed" << endl;
 }
 
 
@@ -130,7 +130,7 @@ bool LdapBackend::reconnect()
   int attempts = m_reconnect_attempts;
   bool connected = false;
   while ( !connected && attempts > 0 ) {
-    L << Logger::Debug << m_myname << " Reconnection attempts left: " << attempts << endl;
+    g_log << Logger::Debug << m_myname << " Reconnection attempts left: " << attempts << endl;
     connected = m_pldap->connect();
     if ( !connected )
       Utility::usleep( 250 );
@@ -158,12 +158,12 @@ bool LdapBackend::list( const DNSName& target, int domain_id, bool include_disab
   }
   catch( LDAPTimeout &lt )
   {
-    L << Logger::Warning << m_myname << " Unable to get zone " << target << " from LDAP directory: " << lt.what() << endl;
+    g_log << Logger::Warning << m_myname << " Unable to get zone " << target << " from LDAP directory: " << lt.what() << endl;
     throw( DBException( "LDAP server timeout" ) );
   }
   catch( LDAPNoConnection &lnc )
   {
-    L << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
+    g_log << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
     if ( reconnect() )
       this->list( target, domain_id );
     else
@@ -171,12 +171,12 @@ bool LdapBackend::list( const DNSName& target, int domain_id, bool include_disab
   }
   catch( LDAPException &le )
   {
-    L << Logger::Error << m_myname << " Unable to get zone " << target << " from LDAP directory: " << le.what() << endl;
+    g_log << Logger::Error << m_myname << " Unable to get zone " << target << " from LDAP directory: " << le.what() << endl;
     throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
   }
   catch( std::exception &e )
   {
-    L << Logger::Error << m_myname << " Caught STL exception for target " << target << ": " << e.what() << endl;
+    g_log << Logger::Error << m_myname << " Caught STL exception for target " << target << ": " << e.what() << endl;
     throw( DBException( "STL exception" ) );
   }
 
@@ -211,7 +211,7 @@ inline bool LdapBackend::list_simple( const DNSName& target, int domain_id )
 
   prepare();
   filter = strbind( ":target:", "associatedDomain=*." + qesc, getArg( "filter-axfr" ) );
-  DLOG( L << Logger::Debug << m_myname << " Search = basedn: " << dn << ", filter: " << filter << endl );
+  DLOG( g_log << Logger::Debug << m_myname << " Search = basedn: " << dn << ", filter: " << filter << endl );
   m_msgid = m_pldap->search( dn, LDAP_SCOPE_SUBTREE, filter, (const char**) ldap_attrany );
 
   return true;
@@ -223,7 +223,7 @@ inline bool LdapBackend::list_strict( const DNSName& target, int domain_id )
 {
   if( target.isPartOf(DNSName("in-addr.arpa")) || target.isPartOf(DNSName("ip6.arpa")) )
   {
-    L << Logger::Warning << m_myname << " Request for reverse zone AXFR, but this is not supported in strict mode" << endl;
+    g_log << Logger::Warning << m_myname << " Request for reverse zone AXFR, but this is not supported in strict mode" << endl;
     return false;   // AXFR isn't supported in strict mode. Use simple mode and additional PTR records
   }
 
@@ -241,17 +241,17 @@ void LdapBackend::lookup( const QType &qtype, const DNSName &qname, DNSPacket *d
     m_adomain = m_adomains.end();   // skip loops in get() first time
     m_qtype = qtype;
 
-    if( m_qlog ) { L.log( "Query: '" + qname.toStringRootDot() + "|" + qtype.getName() + "'", Logger::Error ); }
+    if( m_qlog ) { g_log.log( "Query: '" + qname.toStringRootDot() + "|" + qtype.getName() + "'", Logger::Error ); }
     (this->*m_lookup_fcnt)( qtype, qname, dnspkt, zoneid );
   }
   catch( LDAPTimeout &lt )
   {
-    L << Logger::Warning << m_myname << " Unable to search LDAP directory: " << lt.what() << endl;
+    g_log << Logger::Warning << m_myname << " Unable to search LDAP directory: " << lt.what() << endl;
     throw( DBException( "LDAP server timeout" ) );
   }
   catch( LDAPNoConnection &lnc )
   {
-    L << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
+    g_log << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
     if ( reconnect() )
       this->lookup( qtype, qname, dnspkt, zoneid );
     else
@@ -259,12 +259,12 @@ void LdapBackend::lookup( const QType &qtype, const DNSName &qname, DNSPacket *d
   }
   catch( LDAPException &le )
   {
-    L << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
+    g_log << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
     throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
   }
   catch( std::exception &e )
   {
-    L << Logger::Error << m_myname << " Caught STL exception for qname " << qname << ": " << e.what() << endl;
+    g_log << Logger::Error << m_myname << " Caught STL exception for qname " << qname << ": " << e.what() << endl;
     throw( DBException( "STL exception" ) );
   }
 }
@@ -291,7 +291,7 @@ void LdapBackend::lookup_simple( const QType &qtype, const DNSName &qname, DNSPa
 
   filter = strbind( ":target:", filter, getArg( "filter-lookup" ) );
 
-  DLOG( L << Logger::Debug << m_myname << " Search = basedn: " << getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
+  DLOG( g_log << Logger::Debug << m_myname << " Search = basedn: " << getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
   m_msgid = m_pldap->search( getArg( "basedn" ), LDAP_SCOPE_SUBTREE, filter, attributes );
 }
 
@@ -336,7 +336,7 @@ void LdapBackend::lookup_strict( const QType &qtype, const DNSName &qname, DNSPa
 
   filter = strbind( ":target:", filter, getArg( "filter-lookup" ) );
 
-  DLOG( L << Logger::Debug << m_myname << " Search = basedn: " << getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
+  DLOG( g_log << Logger::Debug << m_myname << " Search = basedn: " << getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
   m_msgid = m_pldap->search( getArg( "basedn" ), LDAP_SCOPE_SUBTREE, filter, attributes );
 }
 
@@ -369,7 +369,7 @@ void LdapBackend::lookup_tree( const QType &qtype, const DNSName &qname, DNSPack
     dn = "dc=" + *i + "," + dn;
   }
 
-  DLOG( L << Logger::Debug << m_myname << " Search = basedn: " << dn + getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
+  DLOG( g_log << Logger::Debug << m_myname << " Search = basedn: " << dn + getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
   m_msgid = m_pldap->search( dn + getArg( "basedn" ), LDAP_SCOPE_BASE, filter, attributes );
 }
 
@@ -387,7 +387,7 @@ inline bool LdapBackend::prepare()
     m_ttl = (uint32_t) strtol( m_result["dNSTTL"][0].c_str(), &endptr, 10 );
     if( *endptr != '\0' )
     {
-      L << Logger::Warning << m_myname << " Invalid time to live for " << m_qname << ": " << m_result["dNSTTL"][0] << endl;
+      g_log << Logger::Warning << m_myname << " Invalid time to live for " << m_qname << ": " << m_result["dNSTTL"][0] << endl;
       m_ttl = m_default_ttl;
     }
     m_result.erase( "dNSTTL" );
@@ -397,7 +397,7 @@ inline bool LdapBackend::prepare()
   {
     if( ( m_last_modified = str2tstamp( m_result["modifyTimestamp"][0] ) ) == 0 )
     {
-      L << Logger::Warning << m_myname << " Invalid modifyTimestamp for " << m_qname << ": " << m_result["modifyTimestamp"][0] << endl;
+      g_log << Logger::Warning << m_myname << " Invalid modifyTimestamp for " << m_qname << ": " << m_result["modifyTimestamp"][0] << endl;
     }
     m_result.erase( "modifyTimestamp" );
   }
@@ -503,7 +503,7 @@ bool LdapBackend::get( DNSResourceRecord &rr )
             rr.content = *m_value;
             m_value++;
 
-            DLOG( L << Logger::Debug << m_myname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", ttl: " << rr.ttl << ", content: " << rr.content << endl );
+            DLOG( g_log << Logger::Debug << m_myname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", ttl: " << rr.ttl << ", content: " << rr.content << endl );
             return true;
           }
 
@@ -520,17 +520,17 @@ bool LdapBackend::get( DNSResourceRecord &rr )
   }
   catch( LDAPTimeout &lt )
   {
-    L << Logger::Warning << m_myname << " Search failed: " << lt.what() << endl;
+    g_log << Logger::Warning << m_myname << " Search failed: " << lt.what() << endl;
     throw( DBException( "LDAP server timeout" ) );
   }
   catch( LDAPException &le )
   {
-    L << Logger::Error << m_myname << " Search failed: " << le.what() << endl;
+    g_log << Logger::Error << m_myname << " Search failed: " << le.what() << endl;
     throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
   }
   catch( std::exception &e )
   {
-    L << Logger::Error << m_myname << " Caught STL exception for " << m_qname << ": " << e.what() << endl;
+    g_log << Logger::Error << m_myname << " Caught STL exception for " << m_qname << ": " << e.what() << endl;
     throw( DBException( "STL exception" ) );
   }
 
@@ -557,12 +557,12 @@ void LdapBackend::getUpdatedMasters( vector<DomainInfo>* domains )
   }
   catch( LDAPTimeout &lt )
   {
-    L << Logger::Warning << m_myname << " Unable to search LDAP directory: " << lt.what() << endl;
+    g_log << Logger::Warning << m_myname << " Unable to search LDAP directory: " << lt.what() << endl;
     throw( DBException( "LDAP server timeout" ) );
   }
   catch( LDAPNoConnection &lnc )
   {
-    L << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
+    g_log << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
     if ( reconnect() )
       this->getUpdatedMasters( domains );
     else
@@ -570,7 +570,7 @@ void LdapBackend::getUpdatedMasters( vector<DomainInfo>* domains )
   }
   catch( LDAPException &le )
   {
-    L << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
+    g_log << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
     throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
   }
   catch( std::exception &e )
@@ -610,12 +610,12 @@ void LdapBackend::setNotified( uint32_t id, uint32_t serial )
   }
   catch( LDAPTimeout &lt )
   {
-    L << Logger::Warning << m_myname << " Unable to search LDAP directory: " << lt.what() << endl;
+    g_log << Logger::Warning << m_myname << " Unable to search LDAP directory: " << lt.what() << endl;
     throw( DBException( "LDAP server timeout" ) );
   }
   catch( LDAPNoConnection &lnc )
   {
-    L << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
+    g_log << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
     if ( reconnect() )
       this->setNotified( id, serial );
     else
@@ -623,7 +623,7 @@ void LdapBackend::setNotified( uint32_t id, uint32_t serial )
   }
   catch( LDAPException &le )
   {
-    L << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
+    g_log << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
     throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
   }
   catch( std::exception &e )
@@ -656,7 +656,7 @@ void LdapBackend::setNotified( uint32_t id, uint32_t serial )
   }
   catch( LDAPNoConnection &lnc )
   {
-    L << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
+    g_log << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
     if ( reconnect() )
       this->setNotified( id, serial );
     else
@@ -664,7 +664,7 @@ void LdapBackend::setNotified( uint32_t id, uint32_t serial )
   }
   catch( LDAPException &le )
   {
-    L << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
+    g_log << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
     throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
   }
   catch( std::exception &e )
@@ -699,12 +699,12 @@ bool LdapBackend::getDomainInfo( const DNSName& domain, DomainInfo& di )
   }
   catch( LDAPTimeout &lt )
   {
-    L << Logger::Warning << m_myname << " Unable to search LDAP directory: " << lt.what() << endl;
+    g_log << Logger::Warning << m_myname << " Unable to search LDAP directory: " << lt.what() << endl;
     throw( DBException( "LDAP server timeout" ) );
   }
   catch( LDAPNoConnection &lnc )
   {
-    L << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
+    g_log << Logger::Warning << m_myname << " Connection to LDAP lost, trying to reconnect" << endl;
     if ( reconnect() )
       this->getDomainInfo( domain, di );
     else
@@ -712,7 +712,7 @@ bool LdapBackend::getDomainInfo( const DNSName& domain, DomainInfo& di )
   }
   catch( LDAPException &le )
   {
-    L << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
+    g_log << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
     throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
   }
   catch( std::exception &e )
@@ -815,7 +815,7 @@ class LdapLoader
    LdapLoader()
    {
      BackendMakers().report( &factory );
-     L << Logger::Info << "[ldapbackend] This is the ldap backend version " VERSION
+     g_log << Logger::Info << "[ldapbackend] This is the ldap backend version " VERSION
 #ifndef REPRODUCIBLE
        << " (" __DATE__ " " __TIME__ ")"
 #endif
index 40b309570b031665e0b6040f27b2915f45bca6ff..6e5084643b309b77a63e32d0c8604e04e96cd5d1 100644 (file)
@@ -73,8 +73,8 @@ public:
 
   ~Lua2BackendAPIv2();
 
-  #define logCall(func, var) { if (d_debug_log) {  L<<Logger::Debug<<"["<<getPrefix()<<"] Calling "<<func<<"("<<var<<")"<< endl; } }
-  #define logResult(var) { if (d_debug_log) { L<<Logger::Debug<<"["<<getPrefix()<<"] Got result " << "'" << var << "'" << endl; } }
+  #define logCall(func, var) { if (d_debug_log) {  g_log<<Logger::Debug<<"["<<getPrefix()<<"] Calling "<<func<<"("<<var<<")"<< endl; } }
+  #define logResult(var) { if (d_debug_log) { g_log<<Logger::Debug<<"["<<getPrefix()<<"] Got result " << "'" << var << "'" << endl; } }
 
   virtual void postPrepareContext() override {
     AuthLua4::postPrepareContext();
@@ -109,7 +109,7 @@ public:
         throw PDNSException("dns_dnssec is true but dns_get_before_and_after_names_absolute is missing");
       /* domain keys is not strictly speaking necessary for dnssec backend */
       if (f_get_domain_keys == nullptr)
-        L<<Logger::Warning<<"dns_get_domain_keys missing - cannot do live signing"<<endl;
+        g_log<<Logger::Warning<<"dns_get_domain_keys missing - cannot do live signing"<<endl;
     }
   }
 
@@ -150,19 +150,19 @@ public:
         else if (item.first == "scopeMask")
           rec.scopeMask = boost::get<int>(item.second);
         else
-          L<<Logger::Warning<<"Unsupported key '"<<item.first<<"' in lookup or list result"<<endl;
+          g_log<<Logger::Warning<<"Unsupported key '"<<item.first<<"' in lookup or list result"<<endl;
 
       }
       logResult(rec.qname<<" IN "<<rec.qtype.getName()<<" "<<rec.ttl<<" "<<rec.getZoneRepresentation());
       d_result.push_back(rec);
     }
     if (d_result.empty() && d_debug_log)
-      L<<Logger::Debug<<"["<<getPrefix()<<"] Got empty result"<<endl;
+      g_log<<Logger::Debug<<"["<<getPrefix()<<"] Got empty result"<<endl;
   }
 
   bool list(const DNSName &target, int domain_id, bool include_disabled=false) override {
     if (f_list == nullptr) {
-      L<<Logger::Error<<"["<<getPrefix()<<"] dns_list missing - cannot do AXFR"<<endl;
+      g_log<<Logger::Error<<"["<<getPrefix()<<"] dns_list missing - cannot do AXFR"<<endl;
       return false;
     }
 
@@ -243,7 +243,7 @@ public:
        else if (item.first == "kind")
          di.kind = DomainInfo::stringToKind(boost::get<string>(item.second));
        else
-         L<<Logger::Warning<<"Unsupported key '"<<item.first<<"' in domaininfo result"<<endl;
+         g_log<<Logger::Warning<<"Unsupported key '"<<item.first<<"' in domaininfo result"<<endl;
      }
      di.backend = this;
      logResult("zone="<<di.zone<<",serial="<<di.serial<<",kind="<<di.getKindString());
@@ -346,7 +346,7 @@ public:
         else if (item.first == "active")
           key.active = boost::get<bool>(item.second);
         else
-          L<<Logger::Warning<<"["<<getPrefix()<<"] Unsupported key '"<<item.first<<"' in keydata result"<<endl;
+          g_log<<Logger::Warning<<"["<<getPrefix()<<"] Unsupported key '"<<item.first<<"' in keydata result"<<endl;
       }
       logResult("id="<<key.id<<",flags="<<key.flags<<",active="<<(key.active ? "true" : "false"));
       keys.push_back(key);
@@ -367,7 +367,7 @@ public:
 
     before_and_after_names_result_t row = boost::get<before_and_after_names_result_t>(result);
     if (row.size() != 3) {
-      L<<Logger::Error<<"Invalid result from dns_get_before_and_after_names_absolute, expected array with 3 items, got "<<row.size()<<"item(s)"<<endl;
+      g_log<<Logger::Error<<"Invalid result from dns_get_before_and_after_names_absolute, expected array with 3 items, got "<<row.size()<<"item(s)"<<endl;
       return false;
     }
     for(const auto& item: row) {
@@ -383,7 +383,7 @@ public:
       else if (item.first == "after")
         after = value;
       else {
-        L<<Logger::Error<<"Invalid result from dns_get_before_and_after_names_absolute, unexpected key "<<item.first<<endl;
+        g_log<<Logger::Error<<"Invalid result from dns_get_before_and_after_names_absolute, unexpected key "<<item.first<<endl;
         return false;
       }
     }
index 254061c7861260210e209575ccee69947ccfa5a2..378203eccdac2c8418b5f3267678e777463468da 100644 (file)
@@ -62,7 +62,7 @@ public:
   {
     BackendMakers().report(new Lua2Factory);
 
-    L << Logger::Info << "[lua2backend] This is the lua2 backend version " VERSION
+    g_log << Logger::Info << "[lua2backend] This is the lua2 backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index ee609ef0fe8be23afdbe647437cdb195d6293f58..076df6f0e999a8f96de8cc4fce30fdaad55dbd15 100644 (file)
@@ -34,14 +34,14 @@ bool LUABackend::updateDNSSECOrderAndAuth(uint32_t domain_id, const DNSName& zon
     if(f_lua_updatednssecorderandauth == 0) {
 
        if(logging)
-           L << Logger::Info << backend_name << "(updateDNSSECOrderAndAuth) domain_id: '" << domain_id << "' zonename: '" << zonename << "' qname: '" << qname << "' auth: '" << auth << "'" << endl;
+           g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuth) domain_id: '" << domain_id << "' zonename: '" << zonename << "' qname: '" << qname << "' auth: '" << auth << "'" << endl;
            
        string ins=qname.makeRelative(zonename).makeLowerCase().labelReverse().toString(" ", false);
        return this->updateDNSSECOrderAndAuthAbsolute(domain_id, qname, ins, auth);
     } 
 
     if(logging)
-        L << Logger::Info << backend_name << "(updateDNSSECOrderAndAuth) BEGIN domain_id: '" << domain_id << "' zonename: '" << zonename << "' qname: '" << qname << "' auth: '" << auth << "'" << endl;
+        g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuth) BEGIN domain_id: '" << domain_id << "' zonename: '" << zonename << "' qname: '" << qname << "' auth: '" << auth << "'" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_updatednssecorderandauth);
 
@@ -67,7 +67,7 @@ bool LUABackend::updateDNSSECOrderAndAuth(uint32_t domain_id, const DNSName& zon
     lua_pop(lua, 1);
 
     if(logging)
-        L << Logger::Info << backend_name << "(updateDNSSECOrderAndAuth) END" << endl;
+        g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuth) END" << endl;
     
     return ok;
 }
@@ -83,7 +83,7 @@ bool LUABackend::updateDNSSECOrderAndAuthAbsolute(uint32_t domain_id, const DNSN
        return false;
        
     if(logging)
-        L << Logger::Info << backend_name << "(updateDNSSECOrderAndAuthAbsolute) BEGIN domain_id: '" << domain_id << "' qname: '" << qname << "' ordername: '" << ordername << "' auth: '" << auth << "'" << endl;
+        g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuthAbsolute) BEGIN domain_id: '" << domain_id << "' qname: '" << qname << "' ordername: '" << ordername << "' auth: '" << auth << "'" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_updatednssecorderandauthabsolute);
 
@@ -109,7 +109,7 @@ bool LUABackend::updateDNSSECOrderAndAuthAbsolute(uint32_t domain_id, const DNSN
     lua_pop(lua, 1);
 
     if(logging)
-        L << Logger::Info << backend_name << "(updateDNSSECOrderAndAuthAbsolute) END" << endl;
+        g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuthAbsolute) END" << endl;
 
     return ok;
 }
@@ -124,7 +124,7 @@ bool LUABackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qnam
     after.clear();
 
     if(logging)
-       L << Logger::Info << backend_name << "(getBeforeAndAfterNamesAbsolute) BEGIN id: '" << id << "' qname: '" << qname << "'" << endl;
+       g_log << Logger::Info << backend_name << "(getBeforeAndAfterNamesAbsolute) BEGIN id: '" << id << "' qname: '" << qname << "'" << endl;
        
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_updatednssecorderandauthabsolute);
 
@@ -144,7 +144,7 @@ bool LUABackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qnam
     
     if (!ok) {
        if(logging)
-           L << Logger::Info << backend_name << "(getBeforeAndAfterNamesAbsolute) ERROR!" << endl;
+           g_log << Logger::Info << backend_name << "(getBeforeAndAfterNamesAbsolute) ERROR!" << endl;
            
        return false;
     }
@@ -166,7 +166,7 @@ bool LUABackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qnam
     lua_pop(lua, 1);
 
     if(logging)
-        L << Logger::Info << backend_name << "(getBeforeAndAfterNamesAbsolute) END unhashed: '" << unhashed << "' before: '" << before << "' after: '" << after << "' " << endl;
+        g_log << Logger::Info << backend_name << "(getBeforeAndAfterNamesAbsolute) END unhashed: '" << unhashed << "' before: '" << before << "' after: '" << after << "' " << endl;
     
     return ok;
 }
@@ -177,7 +177,7 @@ bool LUABackend::updateDomainKey(const DNSName& name, unsigned int &id, bool too
        return false;
 
     if(logging)
-       L << Logger::Info << backend_name << "(updateDomainKey) BEGIN name: '" << name << "' id: '" << id << "' toowhat: '" << toowhat << "'" << endl;
+       g_log << Logger::Info << backend_name << "(updateDomainKey) BEGIN name: '" << name << "' id: '" << id << "' toowhat: '" << toowhat << "'" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_updatedomainkey);
 
@@ -202,7 +202,7 @@ bool LUABackend::updateDomainKey(const DNSName& name, unsigned int &id, bool too
     lua_pop(lua, 1);
 
     if(logging)
-       L << Logger::Info << backend_name << "(updateDomainKey) END" << endl;
+       g_log << Logger::Info << backend_name << "(updateDomainKey) END" << endl;
        
     return ok;
 }
@@ -213,7 +213,7 @@ bool LUABackend::activateDomainKey(const DNSName& name, unsigned int id) {
        return updateDomainKey(name, id, true);
 
     if(logging)
-       L << Logger::Info << backend_name << "(activateDomainKey) BEGIN name: '" << name << "' id: '" << id << endl;
+       g_log << Logger::Info << backend_name << "(activateDomainKey) BEGIN name: '" << name << "' id: '" << id << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_activatedomainkey);
 
@@ -237,7 +237,7 @@ bool LUABackend::activateDomainKey(const DNSName& name, unsigned int id) {
     lua_pop(lua, 1);
 
     if(logging)
-       L << Logger::Info << backend_name << "(activateDomainKey) END" << endl;
+       g_log << Logger::Info << backend_name << "(activateDomainKey) END" << endl;
        
     return ok;
 }
@@ -248,7 +248,7 @@ bool LUABackend::deactivateDomainKey(const DNSName& name, unsigned int id) {
        return updateDomainKey(name, id, false);
 
     if(logging)
-       L << Logger::Info << backend_name << "(deactivateDomainKey) BEGIN name: '" << name << "' id: '" << id << endl;
+       g_log << Logger::Info << backend_name << "(deactivateDomainKey) BEGIN name: '" << name << "' id: '" << id << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_deactivatedomainkey);
 
@@ -272,7 +272,7 @@ bool LUABackend::deactivateDomainKey(const DNSName& name, unsigned int id) {
     lua_pop(lua, 1);
 
     if(logging)
-       L << Logger::Info << backend_name << "(deactivateDomainKey) END" << endl;
+       g_log << Logger::Info << backend_name << "(deactivateDomainKey) END" << endl;
        
     return ok;
 }
@@ -283,7 +283,7 @@ bool LUABackend::removeDomainKey(const DNSName& name, unsigned int id) {
        return false;
 
     if(logging)
-       L << Logger::Info << backend_name << "(removeDomainKey) BEGIN name: '" << name << "' id: '" << id << endl;
+       g_log << Logger::Info << backend_name << "(removeDomainKey) BEGIN name: '" << name << "' id: '" << id << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_removedomainkey);
 
@@ -307,7 +307,7 @@ bool LUABackend::removeDomainKey(const DNSName& name, unsigned int id) {
     lua_pop(lua, 1);
 
     if(logging)
-       L << Logger::Info << backend_name << "(removeDomainKey) END" << endl;
+       g_log << Logger::Info << backend_name << "(removeDomainKey) END" << endl;
        
     return ok;
 }
@@ -321,7 +321,7 @@ bool LUABackend::addDomainKey(const DNSName& name, const KeyData& key, int64_t&
        return false;
 
     if(logging)
-       //L << Logger::Info << backend_name << "(addDomainKey) BEGIN name: '" << name << "' id: '" << id << endl;
+       //g_log << Logger::Info << backend_name << "(addDomainKey) BEGIN name: '" << name << "' id: '" << id << endl;
        cerr << backend_name << "(addDomainKey) BEGIN name: '" << name << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_adddomainkey);
@@ -368,7 +368,7 @@ bool LUABackend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys)
        return false;
 
     if(logging)
-       L << Logger::Info << backend_name << "(getDomainKeys) BEGIN name: '" << name << endl;
+       g_log << Logger::Info << backend_name << "(getDomainKeys) BEGIN name: '" << name << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getdomainkeys);
 
@@ -386,7 +386,7 @@ bool LUABackend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys)
     if (returnedwhat != LUA_TTABLE) {
        lua_pop(lua, 1);
        if(logging)
-           L << Logger::Info << backend_name << "(getDomainKeys) ERROR!" << endl;
+           g_log << Logger::Info << backend_name << "(getDomainKeys) ERROR!" << endl;
            
        return false;
     }
@@ -416,7 +416,7 @@ bool LUABackend::getDomainKeys(const DNSName& name, std::vector<KeyData>& keys)
     }
 
     if(logging)
-       L << Logger::Info << backend_name << "(getDomainKeys) END" << endl;
+       g_log << Logger::Info << backend_name << "(getDomainKeys) END" << endl;
        
     return j > 0;
 }
@@ -427,7 +427,7 @@ bool LUABackend::getTSIGKey(const DNSName& name, DNSName* algorithm, string* con
        return false;
 
     if(logging)
-       L << Logger::Info << backend_name << "(getTSIGKey) BEGIN name: '" << name << "'" << endl;
+       g_log << Logger::Info << backend_name << "(getTSIGKey) BEGIN name: '" << name << "'" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_gettsigkey);
 
@@ -444,7 +444,7 @@ bool LUABackend::getTSIGKey(const DNSName& name, DNSName* algorithm, string* con
     if ( (lua_type(lua, -1) != LUA_TSTRING) && (lua_type(lua, -2) != LUA_TSTRING) ) {
        lua_pop(lua, 2);
        if(logging)
-           L << Logger::Info << backend_name << "(getTSIGKey) ERROR" << endl;
+           g_log << Logger::Info << backend_name << "(getTSIGKey) ERROR" << endl;
        return false;
     }
     
@@ -460,7 +460,7 @@ bool LUABackend::getTSIGKey(const DNSName& name, DNSName* algorithm, string* con
     *content = c;
     
     if(logging)
-       L << Logger::Info << backend_name << "(getTSIGKey) END" << endl;
+       g_log << Logger::Info << backend_name << "(getTSIGKey) END" << endl;
        
     return true;
 }
@@ -471,7 +471,7 @@ bool LUABackend::setDomainMetadata(const DNSName& name, const std::string& kind,
        return false;
 
     if(logging)
-       L << Logger::Info << backend_name << "(setDomainMetadata) BEGIN name: '" << name << "' kind: '" << kind << "'" << endl;
+       g_log << Logger::Info << backend_name << "(setDomainMetadata) BEGIN name: '" << name << "' kind: '" << kind << "'" << endl;
        
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_setdomainmetadata);
 
@@ -508,7 +508,7 @@ bool LUABackend::setDomainMetadata(const DNSName& name, const std::string& kind,
     lua_pop(lua, 1);
 
     if(logging)
-       L << Logger::Info << backend_name << "(setDomainMetadata) END" << endl;
+       g_log << Logger::Info << backend_name << "(setDomainMetadata) END" << endl;
        
     return ok;
 
@@ -519,7 +519,7 @@ bool LUABackend::getDomainMetadata(const DNSName& name, const std::string& kind,
        return false;
 
     if(logging)
-       L << Logger::Info << backend_name << "(getDomainMetadata) BEGIN name: '" << name << "' kind: '" << kind << "'" << endl;
+       g_log << Logger::Info << backend_name << "(getDomainMetadata) BEGIN name: '" << name << "' kind: '" << kind << "'" << endl;
        
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getdomainmetadata);
 
@@ -553,7 +553,7 @@ bool LUABackend::getDomainMetadata(const DNSName& name, const std::string& kind,
     }
 
     if(logging)
-       L << Logger::Info << backend_name << "(getDomainMetadata) END" << endl;
+       g_log << Logger::Info << backend_name << "(getDomainMetadata) END" << endl;
        
     return j > 0;
 
@@ -565,7 +565,7 @@ void LUABackend::alsoNotifies(const DNSName& domain, set<string> *ips) {
        return;
 
     if(logging)
-       L << Logger::Info << backend_name << "(alsonotifies) BEGIN domain: '" << domain << "'" << endl;
+       g_log << Logger::Info << backend_name << "(alsonotifies) BEGIN domain: '" << domain << "'" << endl;
        
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_alsonotifies);
 
@@ -596,7 +596,7 @@ void LUABackend::alsoNotifies(const DNSName& domain, set<string> *ips) {
     }
 
     if(logging)
-       L << Logger::Info << backend_name << "(alsoNotifies) END" << endl;
+       g_log << Logger::Info << backend_name << "(alsoNotifies) END" << endl;
        
     return;
 
index 5c621278775e91747d4e67e28315a4b8e2d67173..cd57a0074539f5c7d959d6d1b5e4d8225a11c4b4 100644 (file)
@@ -158,7 +158,7 @@ int l_logger (lua_State *lua) {
        space = " ";
     }
 
-    L.log(lb->backend_name + s.str(), (Logger::Urgency) log_level);
+    g_log.log(lb->backend_name + s.str(), (Logger::Urgency) log_level);
 
     return 0;
 }
index 72600a8bd06a5a11f30b7a3917cc9691b1fb6ce2..57d059c1afa05539e69d8c2652a09645652f287c 100644 (file)
@@ -57,7 +57,7 @@ public:
   {
     BackendMakers().report(new LUAFactory);
     
-    L << Logger::Info << "[luabackend] This is the lua backend version " VERSION
+    g_log << Logger::Info << "[luabackend] This is the lua backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index b96fdadff4d12de29eea13c69f7b6da70dbaf4d6..5e1f3ac95298bfb5783b9704d7428171652d45a6 100644 (file)
@@ -36,7 +36,6 @@
 #include <string>
 using std::string;
 
-//#undef L
 
 
 
index 9b5293fdd121f666c31b5707cc423be6c21ca1a5..6ca3dc69e2ddcf6ec2dc3e0622f74f30462fb753 100644 (file)
@@ -34,7 +34,7 @@ void LUABackend::getUpdatedMasters(vector<DomainInfo>* domains) {
        return;
 
     if (logging)
-       L << Logger::Info << backend_name << "(getUpdatedMasters) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(getUpdatedMasters) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getupdatedmasters);
 
@@ -55,7 +55,7 @@ void LUABackend::getUpdatedMasters(vector<DomainInfo>* domains) {
     domains_from_table(domains, "getUpdatedMasters");
     
     if (logging)
-       L << Logger::Info << backend_name << "(getUpdatedMasters) END" << endl;
+       g_log << Logger::Info << backend_name << "(getUpdatedMasters) END" << endl;
 }
 
 void LUABackend::setNotified(uint32_t id, uint32_t serial) {
@@ -64,7 +64,7 @@ void LUABackend::setNotified(uint32_t id, uint32_t serial) {
        return;
 
     if (logging)
-       L << Logger::Info << backend_name << "(setNotified) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(setNotified) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_setnotified);
 
@@ -80,6 +80,6 @@ void LUABackend::setNotified(uint32_t id, uint32_t serial) {
     }
 
     if (logging)
-       L << Logger::Info << backend_name << "(setNotified) END" << endl;
+       g_log << Logger::Info << backend_name << "(setNotified) END" << endl;
 }
 
index 24b3e7e4afe581c7d864b0a3615234f7247ff662..9cc0bf63e4608ae2e9324034b79d76e7eef35ede 100644 (file)
@@ -54,7 +54,7 @@ LUABackend::LUABackend(const string &suffix) {
     }
 
     catch(LUAException &e) {
-        L<<Logger::Error<<backend_name<<"Error: "<<e.what<<endl;
+        g_log<<Logger::Error<<backend_name<<"Error: "<<e.what<<endl;
         throw PDNSException(e.what);
     }
 
@@ -62,7 +62,7 @@ LUABackend::LUABackend(const string &suffix) {
 
 LUABackend::~LUABackend() {
     try {
-        L<<Logger::Info<<backend_name<<"Closing..." << endl;
+        g_log<<Logger::Info<<backend_name<<"Closing..." << endl;
     }
     catch (...) {
     }
@@ -72,7 +72,7 @@ LUABackend::~LUABackend() {
 
 bool LUABackend::list(const DNSName &target, int domain_id, bool include_disabled) {
     if (logging)
-       L << Logger::Info << backend_name << "(list) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(list) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_list);
 
@@ -95,14 +95,14 @@ bool LUABackend::list(const DNSName &target, int domain_id, bool include_disable
     lua_pop(lua, 1);
 
     if (logging)
-       L << Logger::Info << backend_name << "(list) END" << endl;
+       g_log << Logger::Info << backend_name << "(list) END" << endl;
 
     return ok;
 }
 
 void LUABackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p, int domain_id) {
     if (logging)
-       L << Logger::Info << backend_name << "(lookup) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(lookup) BEGIN" << endl;
 
     dnspacket = p;
 
@@ -126,12 +126,12 @@ void LUABackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p,
     dnspacket = NULL;
 
     if (logging)
-       L << Logger::Info << backend_name << "(lookup) END" << endl;
+       g_log << Logger::Info << backend_name << "(lookup) END" << endl;
 }
 
 bool LUABackend::get(DNSResourceRecord &rr) {
     if (logging)
-       L << Logger::Info << backend_name << "(get) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(get) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_get);
 
@@ -171,14 +171,14 @@ bool LUABackend::get(DNSResourceRecord &rr) {
     lua_pop(lua, 1 );
 
     if (logging)
-       L << Logger::Info << backend_name << "(get) END" << endl;
+       g_log << Logger::Info << backend_name << "(get) END" << endl;
 
     return !rr.content.empty();
 }
 
 bool LUABackend::getSOA(const DNSName &name, SOAData &soadata, bool unmodifiedSerial) {
     if (logging)
-       L << Logger::Info << backend_name << "(getsoa) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(getsoa) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getsoa);
 
@@ -225,7 +225,7 @@ bool LUABackend::getSOA(const DNSName &name, SOAData &soadata, bool unmodifiedSe
     if (!getValueFromTable(lua, "nameserver", soadata.nameserver)) {
         soadata.nameserver = DNSName(arg()["default-soa-name"]);
         if (soadata.nameserver.empty()) {
-           L<<Logger::Error << backend_name << "(getSOA)" << " Error: SOA Record is missing nameserver for the domain '" << name << "'" << endl;
+           g_log<<Logger::Error << backend_name << "(getSOA)" << " Error: SOA Record is missing nameserver for the domain '" << name << "'" << endl;
            lua_pop(lua, 1 );
             return false;
         }
@@ -237,7 +237,7 @@ bool LUABackend::getSOA(const DNSName &name, SOAData &soadata, bool unmodifiedSe
     lua_pop(lua, 1 );
 
     if (logging)
-       L << Logger::Info << backend_name << "(getsoa) END" << endl;
+       g_log << Logger::Info << backend_name << "(getsoa) END" << endl;
 
     return true;
 }
index de135c003bf4ad54bf84af019ea29eab3b677d76..43b29d559cc05b0b4094d8c51fc1bd9ad003f9f6 100644 (file)
@@ -166,7 +166,7 @@ void LUABackend::rediscover(string* status) {
         return;
 
     if (logging)
-       L << Logger::Info << backend_name << "(rediscover) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(rediscover) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_rediscover);
 
@@ -188,7 +188,7 @@ void LUABackend::rediscover(string* status) {
     *status = s;
     
     if (logging)
-       L << Logger::Info << backend_name << "(rediscover) END" << endl;
+       g_log << Logger::Info << backend_name << "(rediscover) END" << endl;
        
     return;
 }
index 2660b7b7f2135cb24e3e5882c4236a7ef1db921d..26d2a3a5ead00f3cfccfee5ebe732bc5bf22fdbb 100644 (file)
@@ -47,7 +47,7 @@ bool LUABackend::startTransaction(const DNSName& qname, int id) {
         return false;
 
     if (logging)
-        L << Logger::Info << backend_name << "(startTransaction) BEGIN" << endl;
+        g_log << Logger::Info << backend_name << "(startTransaction) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_starttransaction);
 
@@ -70,7 +70,7 @@ bool LUABackend::startTransaction(const DNSName& qname, int id) {
     lua_pop(lua, 1);
     
     if (logging)
-       L << Logger::Info << backend_name << "(startTransaction) END" << endl;
+       g_log << Logger::Info << backend_name << "(startTransaction) END" << endl;
        
     return ok;
 }
@@ -81,7 +81,7 @@ bool LUABackend::commitTransaction() {
         return false;
         
     if (logging)
-       L << Logger::Info << backend_name << "(commitTransaction) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(commitTransaction) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_committransaction);
 
@@ -101,7 +101,7 @@ bool LUABackend::commitTransaction() {
     lua_pop(lua, 1);
     
     if (logging)
-       L << Logger::Info << backend_name << "(commitTransaction) END" << endl;
+       g_log << Logger::Info << backend_name << "(commitTransaction) END" << endl;
        
     return ok;
 }
@@ -112,7 +112,7 @@ bool LUABackend::abortTransaction() {
         return false;
 
     if (logging)
-       L << Logger::Info << backend_name << "(abortTransaction) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(abortTransaction) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_aborttransaction);
 
@@ -132,7 +132,7 @@ bool LUABackend::abortTransaction() {
     lua_pop(lua, 1);
 
     if (logging)
-       L << Logger::Info << backend_name << "(abortTransaction) END" << endl;
+       g_log << Logger::Info << backend_name << "(abortTransaction) END" << endl;
     return ok;
 }
 
@@ -142,7 +142,7 @@ bool LUABackend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordernam
         return false;
 
     if (logging)
-       L << Logger::Info << backend_name << "(feedRecord) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(feedRecord) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_feedrecord);
     dnsrr_to_table(lua, &rr);
@@ -163,7 +163,7 @@ bool LUABackend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordernam
     lua_pop(lua, 1);
 
     if (logging)
-       L << Logger::Info << backend_name << "(feedRecord) END" << endl;
+       g_log << Logger::Info << backend_name << "(feedRecord) END" << endl;
        
     return ok;
 }
@@ -174,7 +174,7 @@ void LUABackend::setFresh(uint32_t id) {
         return;
 
     if (logging)
-       L << Logger::Info << backend_name << "(setFresh) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(setFresh) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_setfresh);
 
@@ -189,7 +189,7 @@ void LUABackend::setFresh(uint32_t id) {
     }
 
     if (logging)
-       L << Logger::Info << backend_name << "(setFresh) END" << endl;
+       g_log << Logger::Info << backend_name << "(setFresh) END" << endl;
 
 }
 
@@ -199,7 +199,7 @@ void LUABackend::getUnfreshSlaveInfos(vector<DomainInfo>* domains) {
         return;
 
     if (logging)
-       L << Logger::Info << backend_name << "(getUnfreshSlaveInfos) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(getUnfreshSlaveInfos) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getunfreshslaveinfos);
 
@@ -220,7 +220,7 @@ void LUABackend::getUnfreshSlaveInfos(vector<DomainInfo>* domains) {
     domains_from_table(domains, "getUnfreshSlaveInfos");
     
     if (logging)
-       L << Logger::Info << backend_name << "(getUnfreshSlaveInfos) END" << endl;
+       g_log << Logger::Info << backend_name << "(getUnfreshSlaveInfos) END" << endl;
 
 }
 
@@ -230,7 +230,7 @@ bool LUABackend::isMaster(const DNSName& domain, const string &ip) {
         return false;
 
     if (logging)
-       L << Logger::Error << backend_name << "(isMaster) BEGIN" << endl;
+       g_log << Logger::Error << backend_name << "(isMaster) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_ismaster);
 
@@ -253,7 +253,7 @@ bool LUABackend::isMaster(const DNSName& domain, const string &ip) {
     lua_pop(lua, 1);
     
     if (logging)
-       L << Logger::Info << backend_name << "(isMaster) END" << endl;
+       g_log << Logger::Info << backend_name << "(isMaster) END" << endl;
 
     return ok;
 }
@@ -263,7 +263,7 @@ bool LUABackend::getDomainInfo(const DNSName&domain, DomainInfo &di) {
         return false;
 
     if (logging)
-       L << Logger::Info << backend_name << "(getDomainInfo) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(getDomainInfo) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getdomaininfo);
 
@@ -283,7 +283,7 @@ bool LUABackend::getDomainInfo(const DNSName&domain, DomainInfo &di) {
     }
 
     if (logging)
-       L << Logger::Info << backend_name << "(getDomainInfo) END" << endl;
+       g_log << Logger::Info << backend_name << "(getDomainInfo) END" << endl;
        
     return domaininfo_from_table(&di);
 }
index 9fdc575e95dc0b9724c709f76b4ee896cf4f7af6..e3075ae8b9234d9079c33521737e8fb2e25f9337 100644 (file)
@@ -43,7 +43,7 @@ bool LUABackend::superMasterBackend(const string &ip, const DNSName &domain, con
         return false;
 
     if (logging)
-       L << Logger::Info << backend_name << "(superMasterBackend) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(superMasterBackend) BEGIN" << endl;
        
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_supermasterbackend);
 
@@ -97,7 +97,7 @@ bool LUABackend::superMasterBackend(const string &ip, const DNSName &domain, con
     }
     
     if (logging)
-       L << Logger::Info << backend_name << "(superMasterBackend) END" << endl;
+       g_log << Logger::Info << backend_name << "(superMasterBackend) END" << endl;
        
     return ok;
 }
@@ -108,7 +108,7 @@ bool LUABackend::createSlaveDomain(const string &ip, const DNSName& domain, cons
         return false;
 
     if (logging)
-       L << Logger::Info << backend_name << "(createSlaveDomain) BEGIN" << endl;
+       g_log << Logger::Info << backend_name << "(createSlaveDomain) BEGIN" << endl;
 
     lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_createslavedomain);
 
@@ -133,7 +133,7 @@ bool LUABackend::createSlaveDomain(const string &ip, const DNSName& domain, cons
     lua_pop(lua, 1);
 
     if (logging)
-       L << Logger::Info << backend_name << "(createSlaveDomain) END" << endl;
+       g_log << Logger::Info << backend_name << "(createSlaveDomain) END" << endl;
        
     return ok;
 }
index 8f57af2309cf5a5ac88c2d90bb40e026e95e99dc..9f06e3e926994fd8e6a306e800a6b375e756b905 100644 (file)
@@ -75,7 +75,7 @@ MyDNSBackend::MyDNSBackend(const string &suffix) {
     d_db->setLog(::arg().mustDo("query-logging"));
   }
   catch(SSqlException &e) {
-    L<<Logger::Error<<backendName<<" Connection failed: "<<e.txtReason()<<endl;
+    g_log<<Logger::Error<<backendName<<" Connection failed: "<<e.txtReason()<<endl;
     throw PDNSException(backendName+"Unable to launch connection: "+e.txtReason());
   }
 
@@ -90,7 +90,7 @@ MyDNSBackend::MyDNSBackend(const string &suffix) {
   d_useminimalttl=mustDo("use-minimal-ttl");
   d_minimum=0;
 
-  L<<Logger::Warning<<backendName<<" Connection successful"<<endl;
+  g_log<<Logger::Warning<<backendName<<" Connection successful"<<endl;
 
   try {
 
@@ -135,7 +135,7 @@ MyDNSBackend::MyDNSBackend(const string &suffix) {
     d_basicQuery_stmt = d_db->prepare(basicQuery, 4);
     d_anyQuery_stmt = d_db->prepare(anyQuery, 5);
   } catch (SSqlException &e) {
-    L<<Logger::Error<<"Cannot prepare statements: " << e.txtReason() <<endl;
+    g_log<<Logger::Error<<"Cannot prepare statements: " << e.txtReason() <<endl;
     throw PDNSException("Cannot prepare statements: " + e.txtReason());
   }
   // keeps static analyzers happy
@@ -179,7 +179,7 @@ bool MyDNSBackend::list(const DNSName &target, int zoneId, bool include_disabled
   d_minimum = pdns_stou(d_result[0][1]);
 
   if (d_result.size()>1) {
-    L<<Logger::Warning<<backendName<<" Found more than one matching origin for zone ID: "<<zoneId<<endl;
+    g_log<<Logger::Warning<<backendName<<" Found more than one matching origin for zone ID: "<<zoneId<<endl;
   };
 
   try {
@@ -236,7 +236,7 @@ bool MyDNSBackend::getSOA(const DNSName& name, SOAData& soadata, bool unmodified
   soadata.db = this;
 
   if (d_result.size()>1) {
-    L<<Logger::Warning<<backendName<<" Found more than one matching zone for: "<<name<<endl;
+    g_log<<Logger::Warning<<backendName<<" Found more than one matching zone for: "<<name<<endl;
   };
 
   return true;
@@ -253,7 +253,7 @@ void MyDNSBackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
     return;
   }
 
-  DLOG(L<<Logger::Debug<<"MyDNSBackend::lookup(" << qtype.getName() << "," << qname << ",p," << zoneId << ")" << endl);
+  DLOG(g_log<<Logger::Debug<<"MyDNSBackend::lookup(" << qtype.getName() << "," << qname << ",p," << zoneId << ")" << endl);
 
   if (zoneId < 0) {
     // First off we need to work out what zone we're working with
@@ -309,7 +309,7 @@ void MyDNSBackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
   if (found) {
 
     while (d_result.size()>1) {
-      L<<Logger::Warning<<backendName<<" Found more than one matching zone for: "+d_origin<<endl;
+      g_log<<Logger::Warning<<backendName<<" Found more than one matching zone for: "+d_origin<<endl;
     };
     // We found the zoneId, so we can work out how to find our rr
     string host;
@@ -321,7 +321,7 @@ void MyDNSBackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
     try {
 
       if (qtype.getCode()==QType::ANY) {
-        DLOG(L<<Logger::Debug<<"Running d_anyQuery_stmt with " << zoneId << ", " << host << ", " << sdom  << ", " << zoneId <<" , "<< qname << ", " << qtype.getName() << endl);
+        DLOG(g_log<<Logger::Debug<<"Running d_anyQuery_stmt with " << zoneId << ", " << host << ", " << sdom  << ", " << zoneId <<" , "<< qname << ", " << qtype.getName() << endl);
         d_query_stmt = &d_anyQuery_stmt;
         (*d_query_stmt)->
           bind("domain_id", zoneId)->
@@ -331,7 +331,7 @@ void MyDNSBackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
           bind("qname2", sdom.toString())->
           execute();
       } else {
-        DLOG(L<<Logger::Debug<<"Running d_basicQuery_stmt with " << zoneId << ", " << host << ", " << qname << ", " << qtype.getName() << endl);
+        DLOG(g_log<<Logger::Debug<<"Running d_basicQuery_stmt with " << zoneId << ", " << host << ", " << qname << ", " << qtype.getName() << endl);
         d_query_stmt = &d_basicQuery_stmt;
         (*d_query_stmt)->
           bind("domain_id", zoneId)->
@@ -489,7 +489,7 @@ class MyDNSLoader {
 public:
   MyDNSLoader() {
     BackendMakers().report(new MyDNSFactory());
-    L << Logger::Info << "[mydnsbackend] This is the mydns backend version " VERSION
+    g_log << Logger::Info << "[mydnsbackend] This is the mydns backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index e8d37f1cc99d0442cf342dc08ca98f26a1697916..ae05d5397b9eb46d5617ca33fd0057a8da795ed4 100644 (file)
@@ -60,7 +60,7 @@ OdbxBackend::OdbxBackend( const string& suffix )
 
                if( getArg( "host" ).size() > 0 )
                {
-                       L.log( m_myname + " WARNING: Using deprecated opendbx-host parameter", Logger::Warning );
+                       g_log.log( m_myname + " WARNING: Using deprecated opendbx-host parameter", Logger::Warning );
                        stringtok( m_hosts[READ], getArg( "host" ), ", " );
                        m_hosts[WRITE] = m_hosts[READ];
                }
@@ -75,7 +75,7 @@ OdbxBackend::OdbxBackend( const string& suffix )
         }
         catch( std::exception& e )
         {
-               L.log( m_myname + " OdbxBackend(): Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " OdbxBackend(): Caught STL exception - " + e.what(),  Logger::Error );
                throw( PDNSException( "Fatal: STL exception" ) );
         }
 }
@@ -100,7 +100,7 @@ bool OdbxBackend::getDomainInfo( const DNSName& domain, DomainInfo& di )
 
         try
         {
-               DLOG( L.log( m_myname + " getDomainInfo()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " getDomainInfo()", Logger::Debug ) );
 
                string stmt = getArg( "sql-zoneinfo" );
                string& stmtref = strbind( ":name", escape( domain.makeLowerCase().toStringRootDot(), READ ), stmt );
@@ -170,7 +170,7 @@ bool OdbxBackend::getDomainInfo( const DNSName& domain, DomainInfo& di )
         }
         catch( std::exception& e )
         {
-               L.log( m_myname + " getDomainInfo: Caught STL std::exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " getDomainInfo: Caught STL std::exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -186,7 +186,7 @@ bool OdbxBackend::getSOA( const DNSName& domain, SOAData& sd, bool unmodifiedSer
 
         try
         {
-               DLOG( L.log( m_myname + " getSOA()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " getSOA()", Logger::Debug ) );
 
                string stmt = getArg( "sql-lookupsoa" );
                string& stmtref = strbind( ":name", escape( domain.makeLowerCase().toStringRootDot(), READ ), stmt );
@@ -236,7 +236,7 @@ bool OdbxBackend::getSOA( const DNSName& domain, SOAData& sd, bool unmodifiedSer
         }
         catch( std::exception& e )
         {
-               L.log( m_myname + " getSOA: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " getSOA: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -249,7 +249,7 @@ bool OdbxBackend::list( const DNSName& target, int zoneid, bool include_disabled
 {
         try
         {
-               DLOG( L.log( m_myname + " list()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " list()", Logger::Debug ) );
 
                m_qname.clear();
                m_result = NULL;
@@ -258,13 +258,13 @@ bool OdbxBackend::list( const DNSName& target, int zoneid, bool include_disabled
 
                if( len < 0 )
                {
-                       L.log( m_myname + " list: Unable to convert zone id to string - format error",  Logger::Error );
+                       g_log.log( m_myname + " list: Unable to convert zone id to string - format error",  Logger::Error );
                        return false;
                }
 
                if( len > static_cast<int>(sizeof( m_buffer )) - 1 )
                {
-                       L.log( m_myname + " list: Unable to convert zone id to string - insufficient buffer space",  Logger::Error );
+                       g_log.log( m_myname + " list: Unable to convert zone id to string - insufficient buffer space",  Logger::Error );
                        return false;
                }
 
@@ -275,7 +275,7 @@ bool OdbxBackend::list( const DNSName& target, int zoneid, bool include_disabled
         }
         catch( std::exception& e )
         {
-               L.log( m_myname + " list: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " list: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -288,7 +288,7 @@ void OdbxBackend::lookup( const QType& qtype, const DNSName& qname, DNSPacket* d
 {
         try
         {
-               DLOG( L.log( m_myname + " lookup()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " lookup()", Logger::Debug ) );
 
                string stmt;
                string& stmtref = stmt;
@@ -320,13 +320,13 @@ void OdbxBackend::lookup( const QType& qtype, const DNSName& qname, DNSPacket* d
 
                        if( len < 0 )
                        {
-                               L.log( m_myname + " lookup: Unable to convert zone id to string - format error",  Logger::Error );
+                               g_log.log( m_myname + " lookup: Unable to convert zone id to string - format error",  Logger::Error );
                                throw( DBException( "Error: Libc error" ) );
                        }
 
                        if( len > static_cast<int>(sizeof( m_buffer )) - 1 )
                        {
-                               L.log( m_myname + " lookup: Unable to convert zone id to string - insufficient buffer space",  Logger::Error );
+                               g_log.log( m_myname + " lookup: Unable to convert zone id to string - insufficient buffer space",  Logger::Error );
                                throw( DBException( "Error: Libc error" ) );
                }
 
@@ -342,7 +342,7 @@ void OdbxBackend::lookup( const QType& qtype, const DNSName& qname, DNSPacket* d
         }
         catch( std::exception& e )
         {
-               L.log( m_myname + " lookup: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " lookup: Caught STL exception - " + e.what(),  Logger::Error );
                throw( DBException( "Error: STL exception" ) );
         }
 }
@@ -356,7 +356,7 @@ bool OdbxBackend::get( DNSResourceRecord& rr )
 
         try
         {
-               DLOG( L.log( m_myname + " get()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " get()", Logger::Debug ) );
 
                if( getRecord( READ ) )
                {
@@ -405,7 +405,7 @@ bool OdbxBackend::get( DNSResourceRecord& rr )
         }
         catch( std::exception& e )
         {
-               L.log( m_myname + " get: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " get: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -420,11 +420,11 @@ void OdbxBackend::setFresh( uint32_t domain_id )
 
         try
         {
-               DLOG( L.log( m_myname + " setFresh()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " setFresh()", Logger::Debug ) );
 
                if( !m_handle[WRITE] && !connectTo( m_hosts[WRITE], WRITE ) )
                {
-                       L.log( m_myname + " setFresh: Master server is unreachable",  Logger::Error );
+                       g_log.log( m_myname + " setFresh: Master server is unreachable",  Logger::Error );
                        throw( DBException( "Error: Server unreachable" ) );
                }
 
@@ -432,13 +432,13 @@ void OdbxBackend::setFresh( uint32_t domain_id )
 
                if( len < 0 )
                {
-                       L.log( m_myname + " setFresh: Unable to insert values into statement '" + getArg( "sql-update-lastcheck" ) + "' - format error",  Logger::Error );
+                       g_log.log( m_myname + " setFresh: Unable to insert values into statement '" + getArg( "sql-update-lastcheck" ) + "' - format error",  Logger::Error );
                        throw( DBException( "Error: Libc error" ) );
                }
 
                if( len > static_cast<int>(sizeof( m_buffer )) - 1 )
                {
-                       L.log( m_myname + " setFresh: Unable to insert values into statement '" + getArg( "sql-update-lastcheck" ) + "' - insufficient buffer space",  Logger::Error );
+                       g_log.log( m_myname + " setFresh: Unable to insert values into statement '" + getArg( "sql-update-lastcheck" ) + "' - insufficient buffer space",  Logger::Error );
                        throw( DBException( "Error: Libc error" ) );
                }
 
@@ -449,7 +449,7 @@ void OdbxBackend::setFresh( uint32_t domain_id )
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " setFresh: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " setFresh: Caught STL exception - " + e.what(),  Logger::Error );
                throw( DBException( "Error: STL exception" ) );
         }
 }
@@ -460,11 +460,11 @@ void OdbxBackend::setNotified( uint32_t domain_id, uint32_t serial )
 {
         try
         {
-               DLOG( L.log( m_myname + " setNotified()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " setNotified()", Logger::Debug ) );
 
                if( !m_handle[WRITE] && !connectTo( m_hosts[WRITE], WRITE ) )
                {
-                       L.log( m_myname + " setFresh: Master server is unreachable",  Logger::Error );
+                       g_log.log( m_myname + " setFresh: Master server is unreachable",  Logger::Error );
                        throw( DBException( "Error: Server unreachable" ) );
                }
 
@@ -472,13 +472,13 @@ void OdbxBackend::setNotified( uint32_t domain_id, uint32_t serial )
 
                if( len < 0 )
                {
-                       L.log( m_myname + " setNotified: Unable to insert values into statement '" + getArg( "sql-update-serial" ) + "' - format error",  Logger::Error );
+                       g_log.log( m_myname + " setNotified: Unable to insert values into statement '" + getArg( "sql-update-serial" ) + "' - format error",  Logger::Error );
                        throw( DBException( "Error: Libc error" ) );
                }
 
                if( len > static_cast<int>(sizeof( m_buffer )) - 1 )
                {
-                       L.log( m_myname + " setNotified: Unable to insert values into statement '" + getArg( "sql-update-serial" ) + "' - insufficient buffer space",  Logger::Error );
+                       g_log.log( m_myname + " setNotified: Unable to insert values into statement '" + getArg( "sql-update-serial" ) + "' - insufficient buffer space",  Logger::Error );
                        throw( DBException( "Error: Libc error" ) );
                }
 
@@ -489,7 +489,7 @@ void OdbxBackend::setNotified( uint32_t domain_id, uint32_t serial )
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " setNotified: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " setNotified: Caught STL exception - " + e.what(),  Logger::Error );
                throw( DBException( "Error: STL exception" ) );
         }
 }
@@ -500,7 +500,7 @@ bool OdbxBackend::isMaster( const DNSName& domain, const string& ip )
 {
         try
         {
-               DLOG( L.log( m_myname + " isMaster()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " isMaster()", Logger::Debug ) );
 
                string stmt = getArg( "sql-master" );
                string& stmtref = strbind( ":name", escape( domain.makeLowerCase().toStringRootDot(), READ ), stmt );
@@ -523,7 +523,7 @@ bool OdbxBackend::isMaster( const DNSName& domain, const string& ip )
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " isMaster: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " isMaster: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -536,11 +536,11 @@ void OdbxBackend::getUnfreshSlaveInfos( vector<DomainInfo>* unfresh )
 {
         try
         {
-               DLOG( L.log( m_myname + " getUnfreshSlaveInfos()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " getUnfreshSlaveInfos()", Logger::Debug ) );
 
                if( unfresh == NULL )
                {
-                       L.log( m_myname + " getUnfreshSlaveInfos: invalid parameter - NULL pointer",  Logger::Error );
+                       g_log.log( m_myname + " getUnfreshSlaveInfos: invalid parameter - NULL pointer",  Logger::Error );
                        return;
                }
 
@@ -548,7 +548,7 @@ void OdbxBackend::getUnfreshSlaveInfos( vector<DomainInfo>* unfresh )
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " getUnfreshSlaveInfo: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " getUnfreshSlaveInfo: Caught STL exception - " + e.what(),  Logger::Error );
         }
 }
 
@@ -558,11 +558,11 @@ void OdbxBackend::getUpdatedMasters( vector<DomainInfo>* updated )
 {
         try
         {
-               DLOG( L.log( m_myname + " getUpdatedMasters()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " getUpdatedMasters()", Logger::Debug ) );
 
                if( updated == NULL )
                {
-                       L.log( m_myname + " getUpdatedMasters: invalid parameter - NULL pointer",  Logger::Error );
+                       g_log.log( m_myname + " getUpdatedMasters: invalid parameter - NULL pointer",  Logger::Error );
                        return;
                }
 
@@ -570,7 +570,7 @@ void OdbxBackend::getUpdatedMasters( vector<DomainInfo>* updated )
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " getUpdatedMasters: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " getUpdatedMasters: Caught STL exception - " + e.what(),  Logger::Error );
         }
 }
 
@@ -580,7 +580,7 @@ bool OdbxBackend::superMasterBackend( const string& ip, const DNSName& domain, c
 {
         try
         {
-               DLOG( L.log( m_myname + " superMasterBackend()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " superMasterBackend()", Logger::Debug ) );
 
                if( account != NULL && ddb != NULL )
                {
@@ -611,7 +611,7 @@ bool OdbxBackend::superMasterBackend( const string& ip, const DNSName& domain, c
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " superMasterBackend: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " superMasterBackend: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -624,11 +624,11 @@ bool OdbxBackend::createSlaveDomain( const string& ip, const DNSName& domain, co
 {
         try
         {
-               DLOG( L.log( m_myname + " createSlaveDomain()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " createSlaveDomain()", Logger::Debug ) );
 
                if( !m_handle[WRITE] && !connectTo( m_hosts[WRITE], WRITE ) )
                {
-                       L.log( m_myname + " createSlaveDomain: Master server is unreachable",  Logger::Error );
+                       g_log.log( m_myname + " createSlaveDomain: Master server is unreachable",  Logger::Error );
                        return false;
                }
 
@@ -637,13 +637,13 @@ bool OdbxBackend::createSlaveDomain( const string& ip, const DNSName& domain, co
 
                if( len < 0 )
                {
-                       L.log( m_myname + " createSlaveDomain: Unable to insert values in statement '" + getArg( "sql-insert-slave" ) + "' - format error",  Logger::Error );
+                       g_log.log( m_myname + " createSlaveDomain: Unable to insert values in statement '" + getArg( "sql-insert-slave" ) + "' - format error",  Logger::Error );
                        return false;
                }
 
                if( len > static_cast<int>(sizeof( m_buffer )) - 1 )
                {
-                       L.log( m_myname + " createSlaveDomain: Unable to insert values in statement '" + getArg( "sql-insert-slave" ) + "' - insufficient buffer space",  Logger::Error );
+                       g_log.log( m_myname + " createSlaveDomain: Unable to insert values in statement '" + getArg( "sql-insert-slave" ) + "' - insufficient buffer space",  Logger::Error );
                        return false;
                }
 
@@ -651,7 +651,7 @@ bool OdbxBackend::createSlaveDomain( const string& ip, const DNSName& domain, co
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " createSlaveDomain: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " createSlaveDomain: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -664,11 +664,11 @@ bool OdbxBackend::feedRecord( const DNSResourceRecord& rr, const DNSName& ordern
 {
         try
         {
-               DLOG( L.log( m_myname + " feedRecord()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " feedRecord()", Logger::Debug ) );
 
                if( !m_handle[WRITE] && !connectTo( m_hosts[WRITE], WRITE ) )
                {
-                       L.log( m_myname + " feedRecord: Master server is unreachable",  Logger::Error );
+                       g_log.log( m_myname + " feedRecord: Master server is unreachable",  Logger::Error );
                        return false;
                }
 
@@ -689,13 +689,13 @@ bool OdbxBackend::feedRecord( const DNSResourceRecord& rr, const DNSName& ordern
 
                if( len < 0 )
                {
-                       L.log( m_myname + " feedRecord: Unable to insert values in statement '" + getArg( "sql-insert-record" ) + "' - format error",  Logger::Error );
+                       g_log.log( m_myname + " feedRecord: Unable to insert values in statement '" + getArg( "sql-insert-record" ) + "' - format error",  Logger::Error );
                        return false;
                }
 
                if( len > static_cast<int>(sizeof( m_buffer )) - 1 )
                {
-                       L.log( m_myname + " feedRecord: Unable to insert values in statement '" + getArg( "sql-insert-record" ) + "' - insufficient buffer space",  Logger::Error );
+                       g_log.log( m_myname + " feedRecord: Unable to insert values in statement '" + getArg( "sql-insert-record" ) + "' - insufficient buffer space",  Logger::Error );
                        return false;
                }
 
@@ -703,7 +703,7 @@ bool OdbxBackend::feedRecord( const DNSResourceRecord& rr, const DNSName& ordern
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " feedRecord: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " feedRecord: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -716,11 +716,11 @@ bool OdbxBackend::startTransaction( const DNSName& domain, int zoneid )
 {
         try
         {
-               DLOG( L.log( m_myname + " startTransaction()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " startTransaction()", Logger::Debug ) );
 
                if( !m_handle[WRITE] && !connectTo( m_hosts[WRITE], WRITE ) )
                {
-                       L.log( m_myname + " startTransaction: Master server is unreachable",  Logger::Error );
+                       g_log.log( m_myname + " startTransaction: Master server is unreachable",  Logger::Error );
                        return false;
                }
 
@@ -730,13 +730,13 @@ bool OdbxBackend::startTransaction( const DNSName& domain, int zoneid )
 
                if( len < 0 )
                {
-                       L.log( m_myname + " startTransaction: Unable to convert zone id to string - format error",  Logger::Error );
+                       g_log.log( m_myname + " startTransaction: Unable to convert zone id to string - format error",  Logger::Error );
                        return false;
                }
 
                if( len > static_cast<int>(sizeof( m_buffer )) - 1 )
                {
-                       L.log( m_myname + " startTransaction: Unable to convert zone id to string - insufficient buffer space",  Logger::Error );
+                       g_log.log( m_myname + " startTransaction: Unable to convert zone id to string - insufficient buffer space",  Logger::Error );
                        return false;
                }
 
@@ -748,7 +748,7 @@ bool OdbxBackend::startTransaction( const DNSName& domain, int zoneid )
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " startTransaction: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " startTransaction: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -761,11 +761,11 @@ bool OdbxBackend::commitTransaction()
 {
         try
         {
-               DLOG( L.log( m_myname + " commitTransaction()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " commitTransaction()", Logger::Debug ) );
 
                if( !m_handle[WRITE] && !connectTo( m_hosts[WRITE], WRITE ) )
                {
-                       L.log( m_myname + " commitTransaction: Master server is unreachable",  Logger::Error );
+                       g_log.log( m_myname + " commitTransaction: Master server is unreachable",  Logger::Error );
                        return false;
                }
 
@@ -774,7 +774,7 @@ bool OdbxBackend::commitTransaction()
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " commitTransaction: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " commitTransaction: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
@@ -787,11 +787,11 @@ bool OdbxBackend::abortTransaction()
 {
         try
         {
-               DLOG( L.log( m_myname + " abortTransaction()", Logger::Debug ) );
+               DLOG( g_log.log( m_myname + " abortTransaction()", Logger::Debug ) );
 
                if( !m_handle[WRITE] && !connectTo( m_hosts[WRITE], WRITE ) )
                {
-                       L.log( m_myname + " abortTransaction: Master server is unreachable",  Logger::Error );
+                       g_log.log( m_myname + " abortTransaction: Master server is unreachable",  Logger::Error );
                        return false;
                }
 
@@ -800,7 +800,7 @@ bool OdbxBackend::abortTransaction()
         }
         catch ( std::exception& e )
         {
-               L.log( m_myname + " abortTransaction: Caught STL exception - " + e.what(),  Logger::Error );
+               g_log.log( m_myname + " abortTransaction: Caught STL exception - " + e.what(),  Logger::Error );
                return false;
         }
 
index 6ebaf5e356299a03ede2ffeca41fad626f3ea6c9..550e93f205d3ac8ff08eaa85e7bed0b2605a5f86 100644 (file)
@@ -165,7 +165,7 @@ public:
         OdbxLoader()
         {
                BackendMakers().report( &factory );
-               L<< Logger::Info << "[opendbxbackend] This is the opendbx backend version " VERSION
+               g_log<< Logger::Info << "[opendbxbackend] This is the opendbx backend version " VERSION
 #ifndef REPRODUCIBLE
                        << " (" __DATE__ " " __TIME__ ")"
 #endif
index 43c564432bc643901ea7c06e942cb55b7bc0cd71..0cf96a06d2cbbefdc6846070c7ae559bd26337de 100644 (file)
@@ -46,7 +46,7 @@ bool OdbxBackend::connectTo( const vector<string>& hosts, QueryType type )
 
         if( type == WRITE && getArg( "backend" ) == "sqlite" )
         {
-               L.log( m_myname + " Using same SQLite connection for reading and writing to '" + hosts[odbx_host_index[READ]] + "'", Logger::Notice );
+               g_log.log( m_myname + " Using same SQLite connection for reading and writing to '" + hosts[odbx_host_index[READ]] + "'", Logger::Notice );
                m_handle[WRITE] = m_handle[READ];
                return true;
         }
@@ -59,15 +59,15 @@ bool OdbxBackend::connectTo( const vector<string>& hosts, QueryType type )
                {
                        if( ( err = odbx_bind( m_handle[type], getArg( "database" ).c_str(), getArg( "username" ).c_str(), getArg( "password" ).c_str(), ODBX_BIND_SIMPLE ) ) == ODBX_ERR_SUCCESS )
                        {
-                               L.log( m_myname + " Database connection (" + (type ? "write" : "read") + ") to '" + hosts[h] + "' succeeded", Logger::Notice );
+                               g_log.log( m_myname + " Database connection (" + (type ? "write" : "read") + ") to '" + hosts[h] + "' succeeded", Logger::Notice );
                                return true;
                        }
 
-                       L.log( m_myname + " Unable to bind to database on host " + hosts[h] + " - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
+                       g_log.log( m_myname + " Unable to bind to database on host " + hosts[h] + " - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
                        continue;
                }
 
-               L.log( m_myname + " Unable to connect to server on host " + hosts[h] + " - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
+               g_log.log( m_myname + " Unable to connect to server on host " + hosts[h] + " - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
         }
 
         m_handle[type] = NULL;
@@ -81,13 +81,13 @@ bool OdbxBackend::execStmt( const char* stmt, unsigned long length, QueryType ty
         int err;
 
 
-        DLOG( L.log( m_myname + " execStmt()", Logger::Debug ) );
+        DLOG( g_log.log( m_myname + " execStmt()", Logger::Debug ) );
 
-        if( m_qlog ) { L.log( m_myname + " Query: " + stmt, Logger::Info ); }
+        if( m_qlog ) { g_log.log( m_myname + " Query: " + stmt, Logger::Info ); }
 
         if( ( err = odbx_query( m_handle[type], stmt, length ) ) < 0 )
         {
-               L.log( m_myname + " execStmt: Unable to execute query - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
+               g_log.log( m_myname + " execStmt: Unable to execute query - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
 
                if( err != -ODBX_ERR_PARAM && odbx_error_type( m_handle[type], err ) > 0 ) { return false; }   // ODBX_ERR_PARAM workaround
                if( !connectTo( m_hosts[type], type ) ) { return false; }
@@ -106,13 +106,13 @@ bool OdbxBackend::getRecord( QueryType type )
         int err = 3;
 
 
-        DLOG( L.log( m_myname + " getRecord()", Logger::Debug ) );
+        DLOG( g_log.log( m_myname + " getRecord()", Logger::Debug ) );
 
         do
         {
                if( err < 0 )
                {
-                       L.log( m_myname + " getRecord: Unable to get next result - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
+                       g_log.log( m_myname + " getRecord: Unable to get next result - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
                        throw( PDNSException( "Error: odbx_result() failed" ) );
                }
 
@@ -122,7 +122,7 @@ bool OdbxBackend::getRecord( QueryType type )
                        {
                                if( ( err = odbx_row_fetch( m_result ) ) < 0 )
                                {
-                                       L.log( m_myname + " getRecord: Unable to get next row - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
+                                       g_log.log( m_myname + " getRecord: Unable to get next row - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
                                        throw( PDNSException( "Error: odbx_row_fetch() failed" ) );
                                }
 
@@ -146,7 +146,7 @@ bool OdbxBackend::getRecord( QueryType type )
                                                }
                                        }
 
-                                       L.log( m_myname + " Values: " + fields,  Logger::Error );
+                                       g_log.log( m_myname + " Values: " + fields,  Logger::Error );
 #endif
                                        return true;
                                }
@@ -171,11 +171,11 @@ string OdbxBackend::escape( const string& str, QueryType type )
         unsigned long len = sizeof( m_escbuf );
 
 
-        DLOG( L.log( m_myname + " escape(string)", Logger::Debug ) );
+        DLOG( g_log.log( m_myname + " escape(string)", Logger::Debug ) );
 
         if( ( err = odbx_escape( m_handle[type], str.c_str(), str.size(), m_escbuf, &len ) ) < 0 )
         {
-               L.log( m_myname + " escape(string): Unable to escape string - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
+               g_log.log( m_myname + " escape(string): Unable to escape string - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
 
                if( err != -ODBX_ERR_PARAM && odbx_error_type( m_handle[type], err ) > 0 ) { throw( runtime_error( "odbx_escape() failed" ) ); }   // ODBX_ERR_PARAM workaround
                if( !connectTo( m_hosts[type], type ) ) { throw( runtime_error( "odbx_escape() failed" ) ); }
@@ -194,7 +194,7 @@ bool OdbxBackend::getDomainList( const string& stmt, vector<DomainInfo>* list, b
 
         SOAData sd;
 
-        DLOG( L.log( m_myname + " getDomainList()", Logger::Debug ) );
+        DLOG( g_log.log( m_myname + " getDomainList()", Logger::Debug ) );
 
         if( !execStmt( stmt.c_str(), stmt.size(), READ ) ) { return false; }
         if( !getRecord( READ ) ) { return false; }
index efcbad8fae512aab619eeee17c1e696761891e4f..fd4e8d5e0f849b15dfffae7dd21f1116cc44a7cd 100644 (file)
@@ -2155,7 +2155,7 @@ private:
         throw OracleException("Setting session pool get mode", oraerr);
       }
     } catch (OracleException &theException) {
-      L << Logger::Critical << "OracleFactory: "
+      g_log << Logger::Critical << "OracleFactory: "
         << theException.reason << endl;
       Cleanup();
       throw theException;
@@ -2176,7 +2176,7 @@ private:
           throw OracleException("OCISessionPoolDestroy", oraerr);
         }
       } catch (OracleException &theException) {
-        L << Logger::Error << "Failed to destroy Oracle session pool: "
+        g_log << Logger::Error << "Failed to destroy Oracle session pool: "
           << theException.reason << endl;
       }
     }
@@ -2290,7 +2290,7 @@ public:
   OracleLoader()
   {
     BackendMakers().report(new OracleFactory);
-    L << Logger::Info << "[oraclebackend] This is the oracle backend version " VERSION
+    g_log << Logger::Info << "[oraclebackend] This is the oracle backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index 1def45c21c1e4742d4e382d5ef735bc3f2e0b570..33950ecacd0c35f057db2c220bd9deaccc9af93b 100644 (file)
@@ -77,7 +77,7 @@ void CoWrapper::launch()
    d_cp->send("HELO\t"+std::to_string(d_abiVersion));
    string banner;
    d_cp->receive(banner);
-   L<<Logger::Error<<"Backend launched with banner: "<<banner<<endl;
+   g_log<<Logger::Error<<"Backend launched with banner: "<<banner<<endl;
 }
 
 void CoWrapper::send(const string &line)
@@ -101,7 +101,7 @@ void CoWrapper::receive(string &line)
       return;
    }
    catch(PDNSException &ae) {
-      L<<Logger::Warning<<kBackendId<<" Unable to receive data from coprocess. "<<ae.reason<<endl;
+      g_log<<Logger::Warning<<kBackendId<<" Unable to receive data from coprocess. "<<ae.reason<<endl;
       delete d_cp;
       d_cp=0;
       throw;
@@ -118,7 +118,7 @@ PipeBackend::PipeBackend(const string &suffix)
      launch();
    }
    catch(const ArgException &A) {
-      L<<Logger::Error<<kBackendId<<" Unable to launch, fatal argument error: "<<A.reason<<endl;
+      g_log<<Logger::Error<<kBackendId<<" Unable to launch, fatal argument error: "<<A.reason<<endl;
       throw;
    }
    catch(...) {
@@ -162,7 +162,7 @@ void PipeBackend::lookup(const QType& qtype,const DNSName& qname, DNSPacket *pkt
     d_disavow=false;
     if(d_regex && !d_regex->match(qname.toStringRootDot())) {
       if(::arg().mustDo("query-logging"))
-        L<<Logger::Error<<"Query for '"<<qname<<"' failed regex '"<<d_regexstr<<"'"<<endl;
+        g_log<<Logger::Error<<"Query for '"<<qname<<"' failed regex '"<<d_regexstr<<"'"<<endl;
       d_disavow=true; // don't pass to backend
     } else {
       ostringstream query;
@@ -185,12 +185,12 @@ void PipeBackend::lookup(const QType& qtype,const DNSName& qname, DNSPacket *pkt
         query <<"\t"<<realRemote.toString(); 
 
       if(::arg().mustDo("query-logging"))
-        L<<Logger::Error<<"Query: '"<<query.str()<<"'"<<endl;
+        g_log<<Logger::Error<<"Query: '"<<query.str()<<"'"<<endl;
       d_coproc->send(query.str());
     }
   }
   catch(PDNSException &pe) {
-    L<<Logger::Error<<kBackendId<<" Error from coprocess: "<<pe.reason<<endl;
+    g_log<<Logger::Error<<kBackendId<<" Error from coprocess: "<<pe.reason<<endl;
     d_disavow = true;
   }
   d_qtype=qtype;
@@ -214,7 +214,7 @@ bool PipeBackend::list(const DNSName& target, int inZoneId, bool include_disable
     d_coproc->send(query.str());
   }
   catch(PDNSException &ae) {
-    L<<Logger::Error<<kBackendId<<" Error from coprocess: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<kBackendId<<" Error from coprocess: "<<ae.reason<<endl;
   }
   d_qname=DNSName(itoa(inZoneId)); // why do we store a number here??
   return true;
@@ -231,7 +231,7 @@ string PipeBackend::directBackendCmd(const string &query) {
     d_coproc->send(oss.str());
   }
   catch(PDNSException &ae) {
-    L<<Logger::Error<<kBackendId<<" Error from coprocess: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<kBackendId<<" Error from coprocess: "<<ae.reason<<endl;
     cleanup();
   }
 
@@ -253,7 +253,7 @@ DNSBackend *PipeBackend::maker()
       return new PipeBackend();
    }
    catch(...) {
-      L<<Logger::Error<<kBackendId<<" Unable to instantiate a pipebackend!"<<endl;
+      g_log<<Logger::Error<<kBackendId<<" Unable to instantiate a pipebackend!"<<endl;
       return 0;
    }
 }
@@ -283,7 +283,7 @@ bool PipeBackend::get(DNSResourceRecord &r)
       vector<string>parts;
       stringtok(parts,line,"\t");
       if(parts.empty()) {
-        L<<Logger::Error<<kBackendId<<" Coprocess returned empty line in query for "<<d_qname<<endl;
+        g_log<<Logger::Error<<kBackendId<<" Coprocess returned empty line in query for "<<d_qname<<endl;
         throw PDNSException("Format error communicating with coprocess");
       }
       else if(parts[0]=="FAIL") {
@@ -293,12 +293,12 @@ bool PipeBackend::get(DNSResourceRecord &r)
         return false;
       }
       else if(parts[0]=="LOG") {
-        L<<Logger::Error<<"Coprocess: "<<line.substr(4)<<endl;
+        g_log<<Logger::Error<<"Coprocess: "<<line.substr(4)<<endl;
         continue;
       }
       else if(parts[0]=="DATA") { // yay
         if(parts.size() < 7 + extraFields) {
-          L<<Logger::Error<<kBackendId<<" Coprocess returned incomplete or empty line in data section for query for "<<d_qname<<endl;
+          g_log<<Logger::Error<<kBackendId<<" Coprocess returned incomplete or empty line in data section for query for "<<d_qname<<endl;
           throw PDNSException("Format error communicating with coprocess in data section");
           // now what?
         }
@@ -325,7 +325,7 @@ bool PipeBackend::get(DNSResourceRecord &r)
         }
         else {
           if(parts.size()< 8 + extraFields) {
-            L<<Logger::Error<<kBackendId<<" Coprocess returned incomplete MX/SRV line in data section for query for "<<d_qname<<endl;
+            g_log<<Logger::Error<<kBackendId<<" Coprocess returned incomplete MX/SRV line in data section for query for "<<d_qname<<endl;
             throw PDNSException("Format error communicating with coprocess in data section of MX/SRV record");
           }
 
@@ -338,11 +338,11 @@ bool PipeBackend::get(DNSResourceRecord &r)
     }
   }
   catch (DBException &dbe) {
-    L<<Logger::Error<<kBackendId<<" "<<dbe.reason<<endl;
+    g_log<<Logger::Error<<kBackendId<<" "<<dbe.reason<<endl;
     throw;
   }
   catch (PDNSException &pe) {
-    L<<Logger::Error<<kBackendId<<" "<<pe.reason<<endl;
+    g_log<<Logger::Error<<kBackendId<<" "<<pe.reason<<endl;
     cleanup();
     throw;
   }
@@ -378,7 +378,7 @@ class PipeLoader
       PipeLoader()
       {
          BackendMakers().report(new PipeFactory);
-         L << Logger::Info << kBackendId <<" This is the pipe backend version " VERSION
+         g_log << Logger::Info << kBackendId <<" This is the pipe backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index 286e606b1a7a6911d2853ae22d22a85de7f1c635..6cec85188deaabd01dded97d2090a87f69ce88f3 100644 (file)
@@ -120,7 +120,7 @@ public:
   RandomLoader()
   {
     BackendMakers().report(new RandomFactory);
-    L << Logger::Info << "[randombackend] This is the random backend version " VERSION
+    g_log << Logger::Info << "[randombackend] This is the random backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index a154da134d516a9dcef568d378d1d7af0d6ece2a..2f973bedf5dcb0ffc299cb8a6383620f021a86f3 100644 (file)
@@ -322,9 +322,9 @@ int HTTPConnector::send_message(const Json& input) {
           d_socket->writenWithTimeout(out.str().c_str(), out.str().size(), timeout);
           rv = 1;
         } catch (NetworkError& ne) {
-          L<<Logger::Error<<"While writing to HTTP endpoint "<<d_addr.toStringWithPort()<<": "<<ne.what()<<std::endl;
+          g_log<<Logger::Error<<"While writing to HTTP endpoint "<<d_addr.toStringWithPort()<<": "<<ne.what()<<std::endl;
         } catch (...) {
-          L<<Logger::Error<<"While writing to HTTP endpoint "<<d_addr.toStringWithPort()<<": exception caught"<<std::endl;
+          g_log<<Logger::Error<<"While writing to HTTP endpoint "<<d_addr.toStringWithPort()<<": exception caught"<<std::endl;
         }
       }
     }
@@ -358,9 +358,9 @@ int HTTPConnector::send_message(const Json& input) {
             d_socket->writenWithTimeout(out.str().c_str(), out.str().size(), timeout);
             rv = 1;
           } catch (NetworkError& ne) {
-            L<<Logger::Error<<"While writing to HTTP endpoint "<<d_addr.toStringWithPort()<<": "<<ne.what()<<std::endl;
+            g_log<<Logger::Error<<"While writing to HTTP endpoint "<<d_addr.toStringWithPort()<<": "<<ne.what()<<std::endl;
           } catch (...) {
-            L<<Logger::Error<<"While writing to HTTP endpoint "<<d_addr.toStringWithPort()<<": exception caught"<<std::endl;
+            g_log<<Logger::Error<<"While writing to HTTP endpoint "<<d_addr.toStringWithPort()<<": exception caught"<<std::endl;
           }
 
           if (rv > -1) break;
@@ -371,7 +371,7 @@ int HTTPConnector::send_message(const Json& input) {
         }
         freeaddrinfo(gAddr);
       } else {
-        L<<Logger::Error<<"Unable to resolve " << req.url.host << ": " << gai_strerror(ec) << std::endl;
+        g_log<<Logger::Error<<"Unable to resolve " << req.url.host << ": " << gai_strerror(ec) << std::endl;
       }
     }
 
@@ -404,12 +404,12 @@ int HTTPConnector::recv_message(Json& output) {
       if (arl.ready() == false)
         throw NetworkError("timeout");
     } catch (NetworkError &ne) {
-      L<<Logger::Error<<"While reading from HTTP endpoint "<<d_addr.toStringWithPort()<<": "<<ne.what()<<std::endl; 
+      g_log<<Logger::Error<<"While reading from HTTP endpoint "<<d_addr.toStringWithPort()<<": "<<ne.what()<<std::endl; 
       delete d_socket;
       d_socket = NULL;
       fail = true;
     } catch (...) {
-      L<<Logger::Error<<"While reading from HTTP endpoint "<<d_addr.toStringWithPort()<<": exception caught"<<std::endl;
+      g_log<<Logger::Error<<"While reading from HTTP endpoint "<<d_addr.toStringWithPort()<<": exception caught"<<std::endl;
       delete d_socket;
       fail = true;
     }
@@ -429,7 +429,7 @@ int HTTPConnector::recv_message(Json& output) {
     std::string err;
     output = Json::parse(resp.body, err);
     if (output != nullptr) return resp.body.size();
-    L<<Logger::Error<<"Cannot parse JSON reply: "<<err<<endl;
+    g_log<<Logger::Error<<"Cannot parse JSON reply: "<<err<<endl;
 
     return rv;
 }
index b7fd605ee525793079895461d0e8a8ce7165be41..53721271dc42d9bba2c54837d78e50998eb8d206 100644 (file)
@@ -26,7 +26,7 @@
 
 PipeConnector::PipeConnector(std::map<std::string,std::string> optionsMap) {
   if (optionsMap.count("command") == 0) {
-    L<<Logger::Error<<"Cannot find 'command' option in connection string"<<endl;
+    g_log<<Logger::Error<<"Cannot find 'command' option in connection string"<<endl;
     throw PDNSException();
   }
   this->command = optionsMap.find("command")->second;
@@ -123,7 +123,7 @@ void PipeConnector::launch() {
   this->send(msg);
   msg = nullptr;
   if (this->recv(msg)==false) {
-    L<<Logger::Error<<"Failed to initialize coprocess"<<std::endl;
+    g_log<<Logger::Error<<"Failed to initialize coprocess"<<std::endl;
   }
 }
 
index c3d694d11d45efb04f9830451b79f059750caa4f..f422fd6cbc5b2516c1fe4bbbb109c22dc9a178ec 100644 (file)
@@ -50,7 +50,7 @@ bool Connector::recv(Json& value) {
        if (value["result"].is_bool() && boolFromJson(value, "result", false) == false)
          rv = false;
        for(const auto& message: value["log"].array_items())
-         L<<Logger::Info<<"[remotebackend]: "<< message.string_value() <<std::endl;
+         g_log<<Logger::Info<<"[remotebackend]: "<< message.string_value() <<std::endl;
        return rv;
     }
     return false;
@@ -81,7 +81,7 @@ bool RemoteBackend::send(Json& value) {
    try {
      return connector->send(value);
    } catch (PDNSException &ex) {
-     L<<Logger::Error<<"Exception caught when sending: "<<ex.reason<<std::endl;
+     g_log<<Logger::Error<<"Exception caught when sending: "<<ex.reason<<std::endl;
    }
 
    delete this->connector;
@@ -93,9 +93,9 @@ bool RemoteBackend::recv(Json& value) {
    try {
      return connector->recv(value);
    } catch (PDNSException &ex) {
-     L<<Logger::Error<<"Exception caught when receiving: "<<ex.reason<<std::endl;
+     g_log<<Logger::Error<<"Exception caught when receiving: "<<ex.reason<<std::endl;
    } catch (...) {
-     L<<Logger::Error<<"Exception caught when receiving"<<std::endl;;
+     g_log<<Logger::Error<<"Exception caught when receiving"<<std::endl;;
    }
 
    delete this->connector;
@@ -605,7 +605,7 @@ void RemoteBackend::setNotified(uint32_t id, uint32_t serial) {
 
    Json answer;
    if (this->send(query) == false || this->recv(answer) == false) {
-      L<<Logger::Error<<kBackendId<<" Failed to execute RPC for RemoteBackend::setNotified("<<id<<","<<serial<<")"<<endl;
+      g_log<<Logger::Error<<kBackendId<<" Failed to execute RPC for RemoteBackend::setNotified("<<id<<","<<serial<<")"<<endl;
    }
 }
 
@@ -960,7 +960,7 @@ DNSBackend *RemoteBackend::maker()
       return new RemoteBackend();
    }
    catch(...) {
-      L<<Logger::Error<<kBackendId<<" Unable to instantiate a remotebackend!"<<endl;
+      g_log<<Logger::Error<<kBackendId<<" Unable to instantiate a remotebackend!"<<endl;
       return 0;
    };
 }
@@ -993,7 +993,7 @@ public:
 
 RemoteLoader::RemoteLoader() {
     BackendMakers().report(new RemoteBackendFactory);
-    L << Logger::Info << kBackendId << " This is the remote backend version " VERSION
+    g_log << Logger::Info << kBackendId << " This is the remote backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index 8b0188cf12be83cd1ca1ee5bfb253c098005f466..766e8a3993007d226cfb61517d906e932ce389e8 100644 (file)
@@ -32,7 +32,7 @@
 
 UnixsocketConnector::UnixsocketConnector(std::map<std::string,std::string> optionsMap) {
   if (optionsMap.count("path") == 0) {
-    L<<Logger::Error<<"Cannot find 'path' option in connection string"<<endl;
+    g_log<<Logger::Error<<"Cannot find 'path' option in connection string"<<endl;
     throw PDNSException();
   } 
   this->timeout = 2000;
@@ -48,7 +48,7 @@ UnixsocketConnector::UnixsocketConnector(std::map<std::string,std::string> optio
 UnixsocketConnector::~UnixsocketConnector() {
   if (this->connected) {
     try {
-      L<<Logger::Info<<"closing socket connection"<<endl;
+      g_log<<Logger::Info<<"closing socket connection"<<endl;
     }
     catch (...) {
     }
@@ -147,23 +147,23 @@ void UnixsocketConnector::reconnect() {
   if (connected) return; // no point reconnecting if connected...
   connected = true;
 
-  L<<Logger::Info<<"Reconnecting to backend" << std::endl;
+  g_log<<Logger::Info<<"Reconnecting to backend" << std::endl;
   fd = socket(AF_UNIX, SOCK_STREAM, 0);
   if (fd < 0) {
      connected = false;
-     L<<Logger::Error<<"Cannot create socket: " << strerror(errno) << std::endl;;
+     g_log<<Logger::Error<<"Cannot create socket: " << strerror(errno) << std::endl;;
      return;
   }
 
   if (makeUNsockaddr(path, &sock)) {
-     L<<Logger::Error<<"Unable to create UNIX domain socket: Path '"<<path<<"' is not a valid UNIX socket path."<<std::endl;
+     g_log<<Logger::Error<<"Unable to create UNIX domain socket: Path '"<<path<<"' is not a valid UNIX socket path."<<std::endl;
      return;
   }
 
   rv = connect(fd, reinterpret_cast<struct sockaddr*>(&sock), sizeof sock);
 
   if (rv != 0 && errno != EISCONN && errno != 0) {
-     L<<Logger::Error<<"Cannot connect to socket: " << strerror(errno) << std::endl;
+     g_log<<Logger::Error<<"Cannot connect to socket: " << strerror(errno) << std::endl;
      close(fd);
      connected = false;
      return;
@@ -179,7 +179,7 @@ void UnixsocketConnector::reconnect() {
   this->send(msg);
   msg = nullptr;
   if (this->recv(msg) == false) {
-     L<<Logger::Warning << "Failed to initialize backend" << std::endl;
+     g_log<<Logger::Warning << "Failed to initialize backend" << std::endl;
      close(fd);
      this->connected = false;
   }
index 1a96d49b092eba6151931ed83485ac4bbb634911..a525d3365c8f5d4d664d700f1c603c495cbd7828 100644 (file)
@@ -30,7 +30,7 @@ ZeroMQConnector::ZeroMQConnector(std::map<std::string,std::string> options) {
 
   // lookup timeout, target and stuff
   if (options.count("endpoint") == 0) {
-    L<<Logger::Error<<"Cannot find 'endpoint' option in connection string"<<endl;
+    g_log<<Logger::Error<<"Cannot find 'endpoint' option in connection string"<<endl;
     throw PDNSException("Cannot find 'endpoint' option in connection string");
   }
   this->d_endpoint = options.find("endpoint")->second;
@@ -47,7 +47,7 @@ ZeroMQConnector::ZeroMQConnector(std::map<std::string,std::string> options) {
 
   if(zmq_connect(this->d_sock, this->d_endpoint.c_str()) < 0)
   {
-    L<<Logger::Error<<"zmq_connect() failed"<< zmq_strerror(errno)<<std::endl;;
+    g_log<<Logger::Error<<"zmq_connect() failed"<< zmq_strerror(errno)<<std::endl;;
     throw PDNSException("Cannot find 'endpoint' option in connection string");
   }
 
@@ -60,7 +60,7 @@ ZeroMQConnector::ZeroMQConnector(std::map<std::string,std::string> options) {
   this->send(msg);
   msg = nullptr;
   if (this->recv(msg)==false) {
-    L<<Logger::Error<<"Failed to initialize zeromq"<<std::endl;
+    g_log<<Logger::Error<<"Failed to initialize zeromq"<<std::endl;
     throw PDNSException("Failed to initialize zeromq");
   } 
 };
@@ -88,13 +88,13 @@ int ZeroMQConnector::send_message(const Json& input) {
        if (zmq_poll(&item, 1, 1)>0) {
          if(zmq_msg_send(&message, this->d_sock, 0) == -1) {
            // message was not sent
-           L<<Logger::Error<<"Cannot send to " << this->d_endpoint << ": " << zmq_strerror(errno)<<std::endl;
+           g_log<<Logger::Error<<"Cannot send to " << this->d_endpoint << ": " << zmq_strerror(errno)<<std::endl;
          } else
            return line.size();
        }
      }
    } catch (std::exception &ex) {
-     L<<Logger::Error<<"Cannot send to " << this->d_endpoint << ": " << ex.what()<<std::endl;
+     g_log<<Logger::Error<<"Cannot send to " << this->d_endpoint << ": " << ex.what()<<std::endl;
      throw PDNSException(ex.what());
    }
 
@@ -131,7 +131,7 @@ int ZeroMQConnector::recv_message(Json& output) {
                if (output != nullptr)
                  rv = msg_size;
                else 
-                 L<<Logger::Error<<"Cannot parse JSON reply from " << this->d_endpoint << ": " << err << endl;
+                 g_log<<Logger::Error<<"Cannot parse JSON reply from " << this->d_endpoint << ": " << err << endl;
                break;
              } else if (errno == EAGAIN) { continue; // try again }
              } else {
@@ -141,7 +141,7 @@ int ZeroMQConnector::recv_message(Json& output) {
         }
      }
    } catch (std::exception &ex) {
-     L<<Logger::Error<<"Cannot receive from " << this->d_endpoint << ": " << ex.what()<<std::endl;
+     g_log<<Logger::Error<<"Cannot receive from " << this->d_endpoint << ": " << ex.what()<<std::endl;
      throw PDNSException(ex.what());
    }
 
index b785c87c920c0514c804d0ff8a911eba61b82e43..d836d34aed14d17b1476d19d2eeacfa4b11b680a 100644 (file)
@@ -34,7 +34,7 @@ CDB::CDB(const string &cdbfile)
   d_fd = open(cdbfile.c_str(), O_RDONLY);
   if (d_fd < 0)
   {
-    L<<Logger::Error<<"Failed to open cdb database file '"<<cdbfile<<"'. Error: "<<stringerror()<<endl;
+    g_log<<Logger::Error<<"Failed to open cdb database file '"<<cdbfile<<"'. Error: "<<stringerror()<<endl;
     throw new PDNSException("Failed to open cdb database file '"+cdbfile+"'. Error: " + stringerror());
   }
 
@@ -42,7 +42,7 @@ CDB::CDB(const string &cdbfile)
   int cdbinit = cdb_init(&d_cdb, d_fd);
   if (cdbinit < 0)
   {
-    L<<Logger::Error<<"Failed to initialize cdb structure. ErrorNr: '"<<cdbinit<<endl;
+    g_log<<Logger::Error<<"Failed to initialize cdb structure. ErrorNr: '"<<cdbinit<<endl;
     throw new PDNSException("Failed to initialize cdb structure.");
   }
 
index 32410f12e60a55d2a7455eec068cd0af1b9ae874..2fbe115cfeb81af0c89c8d3a9ff8495bd44dde93 100644 (file)
@@ -141,9 +141,9 @@ void TinyDNSBackend::setNotified(uint32_t id, uint32_t serial) {
   TDIById_t& domain_index = domains->get<tag_domainid>();
   TDIById_t::iterator itById = domain_index.find(id);
   if (itById == domain_index.end()) {
-    L<<Logger::Error<<backendname<<"Received updated serial("<<serial<<"), but domain ID ("<<id<<") is not known in this backend."<<endl;
+    g_log<<Logger::Error<<backendname<<"Received updated serial("<<serial<<"), but domain ID ("<<id<<") is not known in this backend."<<endl;
   } else {
-    DLOG(L<<Logger::Debug<<backendname<<"Setting serial for "<<itById->zone<<" to "<<serial<<endl);
+    DLOG(g_log<<Logger::Debug<<backendname<<"Setting serial for "<<itById->zone<<" to "<<serial<<endl);
     domain_index.modify(itById, TDI_SerialModifier(serial));
   }
   s_domainInfo[d_suffix] = *domains;
@@ -188,8 +188,8 @@ void TinyDNSBackend::lookup(const QType &qtype, const DNSName &qdomain, DNSPacke
 
   string key=simpleCompress(queryDomain);
 
-  DLOG(L<<Logger::Debug<<backendname<<"[lookup] query for qtype ["<<qtype.getName()<<"] qdomain ["<<qdomain<<"]"<<endl);
-  DLOG(L<<Logger::Debug<<"[lookup] key ["<<makeHexDump(key)<<"]"<<endl);
+  DLOG(g_log<<Logger::Debug<<backendname<<"[lookup] query for qtype ["<<qtype.getName()<<"] qdomain ["<<qdomain<<"]"<<endl);
+  DLOG(g_log<<Logger::Debug<<"[lookup] key ["<<makeHexDump(key)<<"]"<<endl);
 
   d_isWildcardQuery = false;
   if (key[0] == '\001' && key[1] == '\052') {
@@ -213,8 +213,8 @@ bool TinyDNSBackend::get(DNSResourceRecord &rr)
     string val = record.second;
     string key = record.first;
 
-    //DLOG(L<<Logger::Debug<<"[GET] Key: "<<makeHexDump(key)<<endl);
-    //DLOG(L<<Logger::Debug<<"[GET] Val: "<<makeHexDump(val)<<endl);
+    //DLOG(g_log<<Logger::Debug<<"[GET] Key: "<<makeHexDump(key)<<endl);
+    //DLOG(g_log<<Logger::Debug<<"[GET] Val: "<<makeHexDump(val)<<endl);
     if (key[0] == '\000' && key[1] == '\045') { // skip locations
       continue;
     }
@@ -305,20 +305,20 @@ bool TinyDNSBackend::get(DNSResourceRecord &rr)
         DLOG(cerr<<"CONTENT: "<<rr.content<<endl);
       }
       catch (...) {
-        L<<Logger::Error<<backendname<<"Failed to parse record content for "<<rr.qname<<" with type "<<rr.qtype.getName();
+        g_log<<Logger::Error<<backendname<<"Failed to parse record content for "<<rr.qname<<" with type "<<rr.qtype.getName();
         if (d_ignorebogus) {
-          L<<". Ignoring!"<<endl;
+          g_log<<". Ignoring!"<<endl;
           continue;
         } else {
-          L<<". Erroring out!"<<endl;
+          g_log<<". Erroring out!"<<endl;
           throw;
         }
       }
-//      DLOG(L<<Logger::Debug<<backendname<<"Returning ["<<rr.content<<"] for ["<<rr.qname<<"] of RecordType ["<<rr.qtype.getName()<<"]"<<endl;);
+//      DLOG(g_log<<Logger::Debug<<backendname<<"Returning ["<<rr.content<<"] for ["<<rr.qname<<"] of RecordType ["<<rr.qtype.getName()<<"]"<<endl;);
       return true;
     }
   } // end of while
-  DLOG(L<<Logger::Debug<<backendname<<"No more records to return."<<endl);
+  DLOG(g_log<<Logger::Debug<<backendname<<"No more records to return."<<endl);
 
   d_cdbReader = nullptr;
   return false;
@@ -349,7 +349,7 @@ class TinyDNSLoader
 public:
   TinyDNSLoader() {
     BackendMakers().report(new TinyDNSFactory);
-    L << Logger::Info << "[tinydnsbackend] This is the tinydns backend version " VERSION
+    g_log << Logger::Info << "[tinydnsbackend] This is the tinydns backend version " VERSION
 #ifndef REPRODUCIBLE
       << " (" __DATE__ " " __TIME__ ")"
 #endif
index 935c9eae7eae7337c3d409cde307c823c505e7e6..5e62d41706fdd4e73f0a8e87212f7cf377eddb65 100644 (file)
@@ -443,7 +443,7 @@ bool ArgvMap::file(const char *fname, bool lax, bool included)
     set("include-dir","Directory to include configuration files from");
 
   if(!parseFile(fname, "", lax)) {
-    L << Logger::Warning << "Unable to open " << fname << std::endl;
+    g_log << Logger::Warning << "Unable to open " << fname << std::endl;
     return false;
   }
 
@@ -453,7 +453,7 @@ bool ArgvMap::file(const char *fname, bool lax, bool included)
     gatherIncludes(extraConfigs); 
     for(const std::string& fn :  extraConfigs) {
       if (!file(fn.c_str(), lax, true)) {
-        L << Logger::Error << fn << " could not be parsed" << std::endl;
+        g_log << Logger::Error << fn << " could not be parsed" << std::endl;
         throw ArgException(fn + " could not be parsed");
       }
     }
@@ -471,18 +471,18 @@ void ArgvMap::gatherIncludes(std::vector<std::string> &extraConfigs) {
 
     // stat
     if (stat(params["include-dir"].c_str(), &st)) {
-       L << Logger::Error << params["include-dir"] << " does not exist!" << std::endl;
+       g_log << Logger::Error << params["include-dir"] << " does not exist!" << std::endl;
        throw ArgException(params["include-dir"] + " does not exist!");
     }
 
     // wonder if it's accessible directory
     if (!S_ISDIR(st.st_mode)) {
-       L << Logger::Error << params["include-dir"] << " is not a directory" << std::endl;
+       g_log << Logger::Error << params["include-dir"] << " is not a directory" << std::endl;
        throw ArgException(params["include-dir"] + " is not a directory");
     }
 
     if (!(dir = opendir(params["include-dir"].c_str()))) {
-       L << Logger::Error << params["include-dir"] << " is not accessible" << std::endl;
+       g_log << Logger::Error << params["include-dir"] << " is not accessible" << std::endl;
        throw ArgException(params["include-dir"] + " is not accessible");
     }
 
@@ -494,7 +494,7 @@ void ArgvMap::gatherIncludes(std::vector<std::string> &extraConfigs) {
         namebuf << params["include-dir"].c_str() << "/" << ent->d_name; // FIXME: Use some path separator
         // ensure it's readable file
         if (stat(namebuf.str().c_str(), &st) || !S_ISREG(st.st_mode)) {
-          L << Logger::Error << namebuf.str() << " is not a file" << std::endl;
+          g_log << Logger::Error << namebuf.str() << " is not a file" << std::endl;
           closedir(dir);
           throw ArgException(namebuf.str() + " does not exist!");
         }
index e1025f1692f66cf5e416c810a4d23fc34b2cf00f..39137630091c1a1accb7b1c2c4dd16889942813e 100644 (file)
@@ -75,7 +75,7 @@ try
 
         writen2WithTimeout(s.getHandle(), msg.c_str(), msg.length(), 2);
       } catch (runtime_error &e){
-        L<<Logger::Warning<<"Unable to write data to carbon server at "<<remote.toStringWithPort()<<": "<<e.what()<<endl;
+        g_log<<Logger::Warning<<"Unable to write data to carbon server at "<<remote.toStringWithPort()<<": "<<e.what()<<endl;
         continue;
       }
     }
@@ -85,16 +85,16 @@ try
 }
 catch(std::exception& e)
 {
-  L<<Logger::Error<<"Carbon thread died: "<<e.what()<<endl;
+  g_log<<Logger::Error<<"Carbon thread died: "<<e.what()<<endl;
   return 0;
 }
 catch(PDNSException& e)
 {
-  L<<Logger::Error<<"Carbon thread died, PDNSException: "<<e.reason<<endl;
+  g_log<<Logger::Error<<"Carbon thread died, PDNSException: "<<e.reason<<endl;
   return 0;
 }
 catch(...)
 {
-  L<<Logger::Error<<"Carbon thread died"<<endl;
+  g_log<<Logger::Error<<"Carbon thread died"<<endl;
   return 0;
 }
index f28a6fdc37102bd69dce913e2a463d3942cdae38..324a0f12bac06f5099f32c572a04064f310a3d01 100644 (file)
@@ -223,7 +223,7 @@ void AuthPacketCache::cleanup()
   totErased = pruneLockedCollectionsVector(d_maps, maxCached, cacheSize);
   *d_statnumentries -= totErased;
 
-  DLOG(L<<"Done with cache clean, cacheSize: "<<(*d_statnumentries)<<", totErased"<<totErased<<endl);
+  DLOG(g_log<<"Done with cache clean, cacheSize: "<<(*d_statnumentries)<<", totErased"<<totErased<<endl);
 }
 
 /* the logic:
@@ -241,13 +241,13 @@ void AuthPacketCache::cleanupIfNeeded()
     time_t now = time(nullptr);
     int timediff = max((int)(now - d_lastclean), 1);
 
-    DLOG(L<<"cleaninterval: "<<d_cleaninterval<<", timediff: "<<timediff<<endl);
+    DLOG(g_log<<"cleaninterval: "<<d_cleaninterval<<", timediff: "<<timediff<<endl);
 
     if (d_cleaninterval == s_maxcleaninterval && timediff < 30) {
       d_cleanskipped = true;
       d_nextclean += d_cleaninterval;
 
-      DLOG(L<<"cleaning skipped, timediff: "<<timediff<<endl);
+      DLOG(g_log<<"cleaning skipped, timediff: "<<timediff<<endl);
 
       return;
     }
@@ -257,7 +257,7 @@ void AuthPacketCache::cleanupIfNeeded()
       d_cleaninterval=std::max(d_cleaninterval, s_mincleaninterval);
       d_cleaninterval=std::min(d_cleaninterval, s_maxcleaninterval);
 
-      DLOG(L<<"new cleaninterval: "<<d_cleaninterval<<endl);
+      DLOG(g_log<<"new cleaninterval: "<<d_cleaninterval<<endl);
     } else {
       d_cleanskipped = false;
     }
index e9c9e7b6e163e6e5f4b1b56f430b74219e1a77f5..033ed32312f08595922749be930833c32fedb57b 100644 (file)
@@ -205,7 +205,7 @@ void AuthQueryCache::cleanup()
   totErased = pruneLockedCollectionsVector(d_maps, maxCached, cacheSize);
 
   *d_statnumentries -= totErased;
-  DLOG(L<<"Done with cache clean, cacheSize: "<<*d_statnumentries<<", totErased"<<totErased<<endl);
+  DLOG(g_log<<"Done with cache clean, cacheSize: "<<*d_statnumentries<<", totErased"<<totErased<<endl);
 }
 
 /* the logic:
@@ -223,13 +223,13 @@ void AuthQueryCache::cleanupIfNeeded()
     time_t now = time(nullptr);
     int timediff = max((int)(now - d_lastclean), 1);
 
-    DLOG(L<<"cleaninterval: "<<d_cleaninterval<<", timediff: "<<timediff<<endl);
+    DLOG(g_log<<"cleaninterval: "<<d_cleaninterval<<", timediff: "<<timediff<<endl);
 
     if (d_cleaninterval == s_maxcleaninterval && timediff < 30) {
       d_cleanskipped = true;
       d_nextclean += d_cleaninterval;
 
-      DLOG(L<<"cleaning skipped, timediff: "<<timediff<<endl);
+      DLOG(g_log<<"cleaning skipped, timediff: "<<timediff<<endl);
 
       return;
     }
@@ -239,7 +239,7 @@ void AuthQueryCache::cleanupIfNeeded()
       d_cleaninterval=std::max(d_cleaninterval, s_mincleaninterval);
       d_cleaninterval=std::min(d_cleaninterval, s_maxcleaninterval);
 
-      DLOG(L<<"new cleaninterval: "<<d_cleaninterval<<endl);
+      DLOG(g_log<<"new cleaninterval: "<<d_cleaninterval<<endl);
     } else {
       d_cleanskipped = false;
     }
index f2d017695c1c91a283cc0dadd3bdd7046137218f..21453f1699050c710c184e5eb5d8865025ac0405 100644 (file)
@@ -340,12 +340,12 @@ bool GSQLBackend::getDomainInfo(const DNSName &domain, DomainInfo &di)
   try {
     SOAData sd;
     if(!getSOA(domain, sd))
-      L<<Logger::Notice<<"No serial for '"<<domain<<"' found - zone is missing?"<<endl;
+      g_log<<Logger::Notice<<"No serial for '"<<domain<<"' found - zone is missing?"<<endl;
     else
       di.serial = sd.serial;
   }
   catch(PDNSException &ae){
-    L<<Logger::Error<<"Error retrieving serial for '"<<domain<<"': "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"Error retrieving serial for '"<<domain<<"': "<<ae.reason<<endl;
   }
 
   di.kind = DomainInfo::stringToKind(type);
@@ -1070,7 +1070,7 @@ void GSQLBackend::lookup(const QType &qtype,const DNSName &qname, DNSPacket *pkt
 
 bool GSQLBackend::list(const DNSName &target, int domain_id, bool include_disabled)
 {
-  DLOG(L<<"GSQLBackend constructing handle for list of domain id '"<<domain_id<<"'"<<endl);
+  DLOG(g_log<<"GSQLBackend constructing handle for list of domain id '"<<domain_id<<"'"<<endl);
 
   try {
     reconnectIfNeeded();
@@ -1114,7 +1114,7 @@ bool GSQLBackend::listSubZone(const DNSName &zone, int domain_id) {
 
 bool GSQLBackend::get(DNSResourceRecord &r)
 {
-  // L << "GSQLBackend get() was called for "<<qtype.getName() << " record: ";
+  // g_log << "GSQLBackend get() was called for "<<qtype.getName() << " record: ";
   SSqlStatement::row_t row;
 
 skiprow:
@@ -1262,7 +1262,7 @@ bool GSQLBackend::deleteDomain(const DNSName &domain)
 
 void GSQLBackend::getAllDomains(vector<DomainInfo> *domains, bool include_disabled)
 {
-  DLOG(L<<"GSQLBackend retrieving all domains."<<endl);
+  DLOG(g_log<<"GSQLBackend retrieving all domains."<<endl);
 
   try {
     reconnectIfNeeded();
@@ -1523,7 +1523,7 @@ bool GSQLBackend::calculateSOASerial(const DNSName& domain, const SOAData& sd, u
       reset();
   }
   catch (const SSqlException& e) {
-    //DLOG(L<<"GSQLBackend unable to calculate SOA serial: " << e.txtReason()<<endl);
+    //DLOG(g_log<<"GSQLBackend unable to calculate SOA serial: " << e.txtReason()<<endl);
     return false;
   }
  
index e2c9022e87aa7060eb415c744d2f4d099a6bce8b..f7a902ad4ef75d58edea5be1ef281748a8883383 100644 (file)
@@ -237,12 +237,12 @@ try
 }
 catch(std::exception& e)
 {
-  L<<Logger::Error<<"Had error retrieving queue sizes: "<<e.what()<<endl;
+  g_log<<Logger::Error<<"Had error retrieving queue sizes: "<<e.what()<<endl;
   return 0;
 }
 catch(PDNSException& e)
 {
-  L<<Logger::Error<<"Had error retrieving queue sizes: "<<e.reason<<endl;
+  g_log<<Logger::Error<<"Had error retrieving queue sizes: "<<e.reason<<endl;
   return 0;
 }
 
@@ -406,18 +406,18 @@ try
         remote = P->getRemote().toString() + "<-" + P->getRealRemote().toString();
       else
         remote = P->getRemote().toString();
-      L << Logger::Notice<<"Remote "<< remote <<" wants '" << P->qdomain<<"|"<<P->qtype.getName() << 
+      g_log << Logger::Notice<<"Remote "<< remote <<" wants '" << P->qdomain<<"|"<<P->qtype.getName() << 
         "', do = " <<P->d_dnssecOk <<", bufsize = "<< P->getMaxReplyLen();
       if(P->d_ednsRawPacketSizeLimit > 0 && P->getMaxReplyLen() != (unsigned int)P->d_ednsRawPacketSizeLimit)
-        L<<" ("<<P->d_ednsRawPacketSizeLimit<<")";
-      L<<": ";
+        g_log<<" ("<<P->d_ednsRawPacketSizeLimit<<")";
+      g_log<<": ";
     }
 
     if((P->d.opcode != Opcode::Notify && P->d.opcode != Opcode::Update) && P->couldBeCached()) {
       bool haveSomething=PC.get(P, &cached); // does the PacketCache recognize this question?
       if (haveSomething) {
         if(logDNSQueries)
-          L<<"packetcache HIT"<<endl;
+          g_log<<"packetcache HIT"<<endl;
         cached.setRemote(&P->d_remote);  // inlined
         cached.setSocket(P->getSocket());                               // inlined
         cached.d_anyLocal = P->d_anyLocal;
@@ -434,13 +434,13 @@ try
 
     if(distributor->isOverloaded()) {
       if(logDNSQueries) 
-        L<<"Dropped query, backends are overloaded"<<endl;
+        g_log<<"Dropped query, backends are overloaded"<<endl;
       overloadDrops++;
       continue;
     }
         
     if(logDNSQueries) 
-      L<<"packetcache MISS"<<endl;
+      g_log<<"packetcache MISS"<<endl;
 
     try {
       distributor->question(P, &sendout); // otherwise, give to the distributor
@@ -453,7 +453,7 @@ try
 }
 catch(PDNSException& pe)
 {
-  L<<Logger::Error<<"Fatal error in question thread: "<<pe.reason<<endl;
+  g_log<<Logger::Error<<"Fatal error in question thread: "<<pe.reason<<endl;
   _exit(1);
 }
 
@@ -499,7 +499,7 @@ void mainthread()
      char *ns;
      ns = getenv("NOTIFY_SOCKET");
      if (ns != nullptr) {
-       L<<Logger::Error<<"Unable to chroot when running from systemd. Please disable chroot= or set the 'Type' for this service to 'simple'"<<endl;
+       g_log<<Logger::Error<<"Unable to chroot when running from systemd. Please disable chroot= or set the 'Type' for this service to 'simple'"<<endl;
        exit(1);
      }
 #endif
@@ -508,11 +508,11 @@ void mainthread()
         gethostbyname("a.root-servers.net"); // this forces all lookup libraries to be loaded
      Utility::dropGroupPrivs(newuid, newgid);
      if(chroot(::arg()["chroot"].c_str())<0 || chdir("/")<0) {
-       L<<Logger::Error<<"Unable to chroot to '"+::arg()["chroot"]+"': "<<strerror(errno)<<", exiting"<<endl; 
+       g_log<<Logger::Error<<"Unable to chroot to '"+::arg()["chroot"]+"': "<<strerror(errno)<<", exiting"<<endl; 
        exit(1);
      }   
      else
-       L<<Logger::Error<<"Chrooted to '"<<::arg()["chroot"]<<"'"<<endl;      
+       g_log<<Logger::Error<<"Chrooted to '"<<::arg()["chroot"]<<"'"<<endl;      
    } else {
      Utility::dropGroupPrivs(newuid, newgid);
    }
@@ -538,9 +538,9 @@ void mainthread()
     algo = DNSSECKeeper::shorthand2algorithm(::arg()["default-"+algotype+"-algorithm"]);
     size = ::arg().asNum("default-"+algotype+"-size");
     if (algo == -1)
-      L<<Logger::Warning<<"Warning: default-"<<algotype<<"-algorithm set to unknown algorithm: "<<::arg()["default-"+algotype+"-algorithm"]<<endl;
+      g_log<<Logger::Warning<<"Warning: default-"<<algotype<<"-algorithm set to unknown algorithm: "<<::arg()["default-"+algotype+"-algorithm"]<<endl;
     else if (algo <= 10 && size == 0)
-      L<<Logger::Warning<<"Warning: default-"<<algotype<<"-algorithm is set to an algorithm ("<<::arg()["default-"+algotype+"-algorithm"]<<") that requires a non-zero default-"<<algotype<<"-size!"<<endl;
+      g_log<<Logger::Warning<<"Warning: default-"<<algotype<<"-algorithm is set to an algorithm ("<<::arg()["default-"+algotype+"-algorithm"]<<") that requires a non-zero default-"<<algotype<<"-size!"<<endl;
   }
 
   // NOW SAFE TO CREATE THREADS!
@@ -582,5 +582,5 @@ void mainthread()
     catch(...){}
   }
   
-  L<<Logger::Error<<"Mainthread exiting - should never happen"<<endl;
+  g_log<<Logger::Error<<"Mainthread exiting - should never happen"<<endl;
 }
index e73eecb8ff655ffd82694d21ac87cec82b55b102..27d6f3507e40634c6b533fa1a5adaeea082e6008 100644 (file)
@@ -65,7 +65,7 @@ void CommunicatorClass::loadArgsIntoSet(const char *listname, set<string> &lists
       listset.insert(caIp.toStringWithPort());
     }
     catch(PDNSException &e) {
-      L<<Logger::Error<<"Unparseable IP in "<<listname<<". Error: "<<e.reason<<endl;
+      g_log<<Logger::Error<<"Unparseable IP in "<<listname<<". Error: "<<e.reason<<endl;
       _exit(1);
     }
   }
@@ -77,7 +77,7 @@ void CommunicatorClass::go()
     PacketHandler::s_allowNotifyFrom.toMasks(::arg()["allow-notify-from"] );
   }
   catch(PDNSException &e) {
-    L<<Logger::Error<<"Unparseable IP in allow-notify-from. Error: "<<e.reason<<endl;
+    g_log<<Logger::Error<<"Unparseable IP in allow-notify-from. Error: "<<e.reason<<endl;
     _exit(1);
   }
 
@@ -92,7 +92,7 @@ void CommunicatorClass::go()
     d_onlyNotify.toMasks(::arg()["only-notify"]);
   }
   catch(PDNSException &e) {
-    L<<Logger::Error<<"Unparseable IP in only-notify. Error: "<<e.reason<<endl;
+    g_log<<Logger::Error<<"Unparseable IP in only-notify. Error: "<<e.reason<<endl;
     _exit(1);
   }
 
@@ -105,7 +105,7 @@ void CommunicatorClass::mainloop(void)
 {
   try {
     signal(SIGPIPE,SIG_IGN);
-    L<<Logger::Error<<"Master/slave communicator launching"<<endl;
+    g_log<<Logger::Error<<"Master/slave communicator launching"<<endl;
     PacketHandler P;
     d_tickinterval=::arg().asNum("slave-cycle-interval");
     makeNotifySockets();
@@ -136,17 +136,17 @@ void CommunicatorClass::mainloop(void)
     }
   }
   catch(PDNSException &ae) {
-    L<<Logger::Error<<"Exiting because communicator thread died with error: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"Exiting because communicator thread died with error: "<<ae.reason<<endl;
     Utility::sleep(1);
     _exit(1);
   }
   catch(std::exception &e) {
-    L<<Logger::Error<<"Exiting because communicator thread died with STL error: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Exiting because communicator thread died with STL error: "<<e.what()<<endl;
     _exit(1);
   }
   catch( ... )
   {
-    L << Logger::Error << "Exiting because communicator caught unknown exception." << endl;
+    g_log << Logger::Error << "Exiting because communicator caught unknown exception." << endl;
     _exit(1);
   }
 }
index f985cc3266e115b53ca91c9747affd705bff8304..39bad74aa1b91af7c84665c4534f49113783c2a2 100644 (file)
@@ -277,10 +277,10 @@ bool DNSSECKeeper::getNSEC3PARAM(const DNSName& zname, NSEC3PARAMRecordContent*
     *ns3p = NSEC3PARAMRecordContent(value);
     if (ns3p->d_iterations > maxNSEC3Iterations) {
       ns3p->d_iterations = maxNSEC3Iterations;
-      L<<Logger::Error<<"Number of NSEC3 iterations for zone '"<<zname<<"' is above 'max-nsec3-iterations'. Value adjusted to: "<<maxNSEC3Iterations<<endl;
+      g_log<<Logger::Error<<"Number of NSEC3 iterations for zone '"<<zname<<"' is above 'max-nsec3-iterations'. Value adjusted to: "<<maxNSEC3Iterations<<endl;
     }
     if (ns3p->d_algorithm != 1) {
-      L<<Logger::Error<<"Invalid hash algorithm for NSEC3: '"<<std::to_string(ns3p->d_algorithm)<<"', setting to 1 for zone '"<<zname<<"'."<<endl;
+      g_log<<Logger::Error<<"Invalid hash algorithm for NSEC3: '"<<std::to_string(ns3p->d_algorithm)<<"', setting to 1 for zone '"<<zname<<"'."<<endl;
       ns3p->d_algorithm = 1;
     }
   }
@@ -486,7 +486,7 @@ DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const DNSName& zone, bool useCache)
     dpk.d_flags = kd.flags;
     dpk.d_algorithm = dkrc.d_algorithm;
     if(dpk.d_algorithm == DNSSECKeeper::RSASHA1 && getNSEC3PARAM(zone)) {
-      L<<Logger::Warning<<"Zone '"<<zone<<"' has NSEC3 semantics, but the "<< (kd.active ? "" : "in" ) <<"active key with id "<<kd.id<<" has 'Algorithm: 5'. This should be corrected to 'Algorithm: 7' in the database (or NSEC3 should be disabled)."<<endl;
+      g_log<<Logger::Warning<<"Zone '"<<zone<<"' has NSEC3 semantics, but the "<< (kd.active ? "" : "in" ) <<"active key with id "<<kd.id<<" has 'Algorithm: 5'. This should be corrected to 'Algorithm: 7' in the database (or NSEC3 should be disabled)."<<endl;
       dpk.d_algorithm = DNSSECKeeper::RSASHA1NSEC3SHA1;
     }
 
@@ -544,7 +544,7 @@ bool DNSSECKeeper::getPreRRSIGs(UeberBackend& db, const DNSName& signer, const D
   // cerr<<"Doing DB lookup for precomputed RRSIGs for '"<<(wildcardname.empty() ? qname : wildcardname)<<"'"<<endl;
         SOAData sd;
         if(!db.getSOAUncached(signer, sd)) {
-                DLOG(L<<"Could not get SOA for domain"<<endl);
+                DLOG(g_log<<"Could not get SOA for domain"<<endl);
                 return false;
         }
         db.lookup(QType(QType::RRSIG), wildcardname.countLabels() ? wildcardname : qname, NULL, sd.domain_id);
@@ -777,7 +777,7 @@ bool DNSSECKeeper::rectifyZone(const DNSName& zone, string& error, string& info,
           {
             if(!(maxent))
             {
-              L<<Logger::Warning<<"Zone '"<<zone<<"' has too many empty non terminals."<<endl;
+              g_log<<Logger::Warning<<"Zone '"<<zone<<"' has too many empty non terminals."<<endl;
               insnonterm.clear();
               delnonterm.clear();
               doent=false;
index 1ffc2a904a9d45d0afa69349a81f33ac137d6f34..490602f3e923de7e10631c551036b1b52770d2b7 100644 (file)
@@ -124,16 +124,16 @@ template<class Answer, class Question, class Backend>Distributor<Answer,Question
 
 template<class Answer, class Question, class Backend>SingleThreadDistributor<Answer,Question,Backend>::SingleThreadDistributor()
 {
-  L<<Logger::Error<<"Only asked for 1 backend thread - operating unthreaded"<<endl;
+  g_log<<Logger::Error<<"Only asked for 1 backend thread - operating unthreaded"<<endl;
   try {
     b=new Backend;
   }
   catch(const PDNSException &AE) {
-    L<<Logger::Error<<"Distributor caught fatal exception: "<<AE.reason<<endl;
+    g_log<<Logger::Error<<"Distributor caught fatal exception: "<<AE.reason<<endl;
     _exit(1);
   }
   catch(...) {
-    L<<Logger::Error<<"Caught an unknown exception when creating backend, probably"<<endl;
+    g_log<<Logger::Error<<"Caught an unknown exception when creating backend, probably"<<endl;
     _exit(1);
   }
 }
@@ -157,16 +157,16 @@ template<class Answer, class Question, class Backend>MultiThreadDistributor<Answ
   }
   
   if (n<1) {
-    L<<Logger::Error<<"Asked for fewer than 1 threads, nothing to do"<<endl;
+    g_log<<Logger::Error<<"Asked for fewer than 1 threads, nothing to do"<<endl;
     _exit(1);
   }
 
-  L<<Logger::Warning<<"About to create "<<n<<" backend threads for UDP"<<endl;
+  g_log<<Logger::Warning<<"About to create "<<n<<" backend threads for UDP"<<endl;
   for(int i=0;i<n;i++) {
     pthread_create(&tid,0,&makeThread,static_cast<void *>(this));
     Utility::usleep(50000); // we've overloaded mysql in the past :-)
   }
-  L<<Logger::Warning<<"Done launching threads, ready to distribute questions"<<endl;
+  g_log<<Logger::Warning<<"Done launching threads, ready to distribute questions"<<endl;
 }
 
 
@@ -211,7 +211,7 @@ retry:
         delete b;
         b=NULL;
         if (!allowRetry) {
-          L<<Logger::Error<<"Backend error: "<<e.reason<<endl;
+          g_log<<Logger::Error<<"Backend error: "<<e.reason<<endl;
           a=QD->Q->replyPacket();
 
           a->setRcode(RCode::ServFail);
@@ -220,7 +220,7 @@ retry:
 
           delete QD->Q;
         } else {
-          L<<Logger::Notice<<"Backend error (retry once): "<<e.reason<<endl;
+          g_log<<Logger::Notice<<"Backend error (retry once): "<<e.reason<<endl;
           goto retry;
         }
       }
@@ -228,7 +228,7 @@ retry:
         delete b;
         b=NULL;
         if (!allowRetry) {
-          L<<Logger::Error<<"Caught unknown exception in Distributor thread "<<(long)pthread_self()<<endl;
+          g_log<<Logger::Error<<"Caught unknown exception in Distributor thread "<<(long)pthread_self()<<endl;
           a=QD->Q->replyPacket();
 
           a->setRcode(RCode::ServFail);
@@ -237,7 +237,7 @@ retry:
 
           delete QD->Q;
         } else {
-          L<<Logger::Warning<<"Caught unknown exception in Distributor thread "<<(long)pthread_self()<<" (retry once)"<<endl;
+          g_log<<Logger::Warning<<"Caught unknown exception in Distributor thread "<<(long)pthread_self()<<" (retry once)"<<endl;
           goto retry;
         }
       }
@@ -249,11 +249,11 @@ retry:
     delete b;
   }
   catch(const PDNSException &AE) {
-    L<<Logger::Error<<"Distributor caught fatal exception: "<<AE.reason<<endl;
+    g_log<<Logger::Error<<"Distributor caught fatal exception: "<<AE.reason<<endl;
     _exit(1);
   }
   catch(...) {
-    L<<Logger::Error<<"Caught an unknown exception when creating backend, probably"<<endl;
+    g_log<<Logger::Error<<"Caught an unknown exception when creating backend, probably"<<endl;
     _exit(1);
   }
   return 0;
@@ -275,14 +275,14 @@ retry:
     delete b;
     b=NULL;
     if (!allowRetry) {
-      L<<Logger::Error<<"Backend error: "<<e.reason<<endl;
+      g_log<<Logger::Error<<"Backend error: "<<e.reason<<endl;
       a=q->replyPacket();
 
       a->setRcode(RCode::ServFail);
       S.inc("servfail-packets");
       S.ringAccount("servfail-queries",q->qdomain.toLogString());
     } else {
-      L<<Logger::Notice<<"Backend error (retry once): "<<e.reason<<endl;
+      g_log<<Logger::Notice<<"Backend error (retry once): "<<e.reason<<endl;
       goto retry;
     }
   }
@@ -290,14 +290,14 @@ retry:
     delete b;
     b=NULL;
     if (!allowRetry) {
-      L<<Logger::Error<<"Caught unknown exception in Distributor thread "<<(unsigned long)pthread_self()<<endl;
+      g_log<<Logger::Error<<"Caught unknown exception in Distributor thread "<<(unsigned long)pthread_self()<<endl;
       a=q->replyPacket();
 
       a->setRcode(RCode::ServFail);
       S.inc("servfail-packets");
       S.ringAccount("servfail-queries",q->qdomain.toLogString());
     } else {
-      L<<Logger::Warning<<"Caught unknown exception in Distributor thread "<<(unsigned long)pthread_self()<<" (retry once)"<<endl;
+      g_log<<Logger::Warning<<"Caught unknown exception in Distributor thread "<<(unsigned long)pthread_self()<<" (retry once)"<<endl;
       goto retry;
     }
   }
@@ -325,7 +325,7 @@ template<class Answer, class Question, class Backend>int MultiThreadDistributor<
 
 
   if(d_queued > d_maxQueueLength) {
-    L<<Logger::Error<< d_queued <<" questions waiting for database/backend attention. Limit is "<<::arg().asNum("max-queue-length")<<", respawning"<<endl;
+    g_log<<Logger::Error<< d_queued <<" questions waiting for database/backend attention. Limit is "<<::arg().asNum("max-queue-length")<<", respawning"<<endl;
     // this will leak the entire contents of all pipes, nothing will be freed. Respawn when this happens!
     throw DistributorFatal();
   }
index cd07856c617f34a9533fa3f8f847a799c6a474fc..46a1b3081a3e1e82684e92109953ec026e9976e0 100644 (file)
@@ -235,7 +235,6 @@ inline uint16_t * getFlagsFromDNSHeader(struct dnsheader * dh)
 #define FLAGS_CD_OFFSET (12)
 #endif
 
-#define L theL()
 extern time_t s_starttime;
 
 uint32_t hashQuestion(const char* packet, uint16_t len, uint32_t init);
index dd4c3d9ba131ad2d3453b9a88d1a1644ad0e3ab8..2a0d52644c0854788c4d0bc9a4a16caa1fa3daee 100644 (file)
@@ -96,7 +96,7 @@ void BackendMakerClass::load_all()
   // TODO: Implement this?
   DIR *dir=opendir(arg()["module-dir"].c_str());
   if(!dir) {
-    L<<Logger::Error<<"Unable to open module directory '"<<arg()["module-dir"]<<"'"<<endl;
+    g_log<<Logger::Error<<"Unable to open module directory '"<<arg()["module-dir"]<<"'"<<endl;
     return;
   }
   struct dirent *entry;
@@ -121,7 +121,7 @@ void BackendMakerClass::load(const string &module)
     res=UeberBackend::loadmodule(arg()["module-dir"]+"/"+module);
 
   if(res==false) {
-    L<<Logger::Error<<"DNSBackend unable to load module in "<<module<<endl;
+    g_log<<Logger::Error<<"DNSBackend unable to load module in "<<module<<endl;
     exit(1);
   }
 }
@@ -184,14 +184,14 @@ vector<DNSBackend *>BackendMakerClass::all(bool metadataOnly)
     }
   }
   catch(PDNSException &ae) {
-    L<<Logger::Error<<"Caught an exception instantiating a backend: "<<ae.reason<<endl;
-    L<<Logger::Error<<"Cleaning up"<<endl;
+    g_log<<Logger::Error<<"Caught an exception instantiating a backend: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"Cleaning up"<<endl;
     for(vector<DNSBackend *>::const_iterator i=ret.begin();i!=ret.end();++i)
       delete *i;
     throw;
   } catch(...) {
     // and cleanup
-    L<<Logger::Error<<"Caught an exception instantiating a backend, cleaning up"<<endl;
+    g_log<<Logger::Error<<"Caught an exception instantiating a backend, cleaning up"<<endl;
     for(vector<DNSBackend *>::const_iterator i=ret.begin();i!=ret.end();++i)
       delete *i;
     throw;
@@ -249,14 +249,14 @@ bool DNSBackend::getSOA(const DNSName &domain, SOAData &sd, bool unmodifiedSeria
   }
 
   if(!unmodifiedSerial && !sd.serial) { // magic time!
-    DLOG(L<<Logger::Warning<<"Doing SOA serial number autocalculation for "<<rr.qname<<endl);
+    DLOG(g_log<<Logger::Warning<<"Doing SOA serial number autocalculation for "<<rr.qname<<endl);
 
     uint32_t serial = 0;
     if (calculateSOASerial(domain, sd, serial)) {
       sd.serial = serial;
-      //DLOG(L<<"autocalculated soa serialnumber for "<<rr.qname<<" is "<<newest<<endl);
+      //DLOG(g_log<<"autocalculated soa serialnumber for "<<rr.qname<<" is "<<newest<<endl);
     } else {
-      DLOG(L<<"soa serialnumber calculation failed for "<<rr.qname<<endl);
+      DLOG(g_log<<"soa serialnumber calculation failed for "<<rr.qname<<endl);
     }
 
   }
@@ -339,7 +339,7 @@ bool DNSBackend::calculateSOASerial(const DNSName& domain, const SOAData& sd, ui
     uint32_t newest=0;
 
     if(!(this->list(domain, sd.domain_id))) {
-      DLOG(L<<Logger::Warning<<"Backend error trying to determine magic serial number of zone '"<<domain<<"'"<<endl);
+      DLOG(g_log<<Logger::Warning<<"Backend error trying to determine magic serial number of zone '"<<domain<<"'"<<endl);
       return false;
     }
 
index 7929dd14ae2e3acf535af37720c241f3b5640875..860657d586b0d16c20aace766898ff508d9a1c47 100644 (file)
@@ -27,7 +27,6 @@
 #include "sstuff.hh"
 
 #include "namespaces.hh"
-#undef L
 #include "dnsdist.hh"
 
 GlobalStateHolder<vector<CarbonConfig> > g_carbon;
index 4f5dfd7cab190c4629ca2b8b2fe047babf0cf0d7..b87c5b3db73bffef07bd36b9d88a905205751583 100644 (file)
@@ -2258,7 +2258,7 @@ try
     bindAny(cs->local.sin4.sin_family, cs->udpFD);
 
     //    if (!setSocketTimestamps(cs->udpFD))
-    //      L<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
+    //      g_log<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
 
 
     if(IsAnyAddress(cs->local)) {
index 846e643cdf10a8c4c3878db23c3c75e36026a7d0..f81a21b6cb503b781f5fd0d67ffee03edd411746 100644 (file)
@@ -94,7 +94,7 @@ uint16_t DNSPacket::getRemotePort() const
 
 DNSPacket::DNSPacket(const DNSPacket &orig)
 {
-  DLOG(L<<"DNSPacket copy constructor called!"<<endl);
+  DLOG(g_log<<"DNSPacket copy constructor called!"<<endl);
   d_socket=orig.d_socket;
   d_remote=orig.d_remote;
   d_dt=orig.d_dt;
@@ -346,7 +346,7 @@ void DNSPacket::wrapup()
       }
     }
     catch(std::exception& e) {
-      L<<Logger::Warning<<"Exception: "<<e.what()<<endl;
+      g_log<<Logger::Warning<<"Exception: "<<e.what()<<endl;
       throw;
     }
   }
@@ -436,7 +436,7 @@ int DNSPacket::noparse(const char *mesg, size_t length)
 {
   d_rawpacket.assign(mesg,length); 
   if(length < 12) { 
-    L << Logger::Debug << "Ignoring packet: too short ("<<length<<" < 12) from "
+    g_log << Logger::Debug << "Ignoring packet: too short ("<<length<<" < 12) from "
       << d_remote.toStringWithPort()<< endl;
     return -1;
   }
@@ -469,7 +469,7 @@ bool DNSPacket::getTSIGDetails(TSIGRecordContent* trc, DNSName* keyname, uint16_
       // cast can fail, f.e. if d_content is an UnknownRecordContent.
       shared_ptr<TSIGRecordContent> content = std::dynamic_pointer_cast<TSIGRecordContent>(i->first.d_content);
       if (!content) {
-        L<<Logger::Error<<"TSIG record has no or invalid content (invalid packet)"<<endl;
+        g_log<<Logger::Error<<"TSIG record has no or invalid content (invalid packet)"<<endl;
         return false;
       }
       *trc = *content;
@@ -494,7 +494,7 @@ bool DNSPacket::getTKEYRecord(TKEYRecordContent *tr, DNSName *keyname) const
 
   for(MOADNSParser::answers_t::const_iterator i=mdp.d_answers.begin(); i!=mdp.d_answers.end(); ++i) {
     if (gotit) {
-      L<<Logger::Error<<"More than one TKEY record found in query"<<endl;
+      g_log<<Logger::Error<<"More than one TKEY record found in query"<<endl;
       return false;
     }
 
@@ -502,7 +502,7 @@ bool DNSPacket::getTKEYRecord(TKEYRecordContent *tr, DNSName *keyname) const
       // cast can fail, f.e. if d_content is an UnknownRecordContent.
       shared_ptr<TKEYRecordContent> content = std::dynamic_pointer_cast<TKEYRecordContent>(i->first.d_content);
       if (!content) {
-        L<<Logger::Error<<"TKEY record has no or invalid content (invalid packet)"<<endl;
+        g_log<<Logger::Error<<"TKEY record has no or invalid content (invalid packet)"<<endl;
         return false;
       }
       *tr = *content;
@@ -524,7 +524,7 @@ try
   d_rawpacket.assign(mesg,length); 
   d_wrapped=true;
   if(length < 12) { 
-    L << Logger::Warning << "Ignoring packet: too short from "
+    g_log << Logger::Warning << "Ignoring packet: too short from "
       << getRemote() << endl;
     return -1;
   }
@@ -582,7 +582,7 @@ try
 
   if(!ntohs(d.qdcount)) {
     if(!d_tcp) {
-      L << Logger::Warning << "No question section in packet from " << getRemote() <<", error="<<RCode::to_s(d.rcode)<<endl;
+      g_log << Logger::Warning << "No question section in packet from " << getRemote() <<", error="<<RCode::to_s(d.rcode)<<endl;
       return -1;
     }
   }
@@ -655,7 +655,7 @@ bool DNSPacket::checkForCorrectTSIG(UeberBackend* B, DNSName* keyname, string* s
   string secret64;
   if (tt.algo != DNSName("gss-tsig")) {
     if(!B->getTSIGKey(*keyname, &tt.algo, &secret64)) {
-      L<<Logger::Error<<"Packet for domain '"<<this->qdomain<<"' denied: can't find TSIG key with name '"<<*keyname<<"' and algorithm '"<<tt.algo<<"'"<<endl;
+      g_log<<Logger::Error<<"Packet for domain '"<<this->qdomain<<"' denied: can't find TSIG key with name '"<<*keyname<<"' and algorithm '"<<tt.algo<<"'"<<endl;
       return false;
     }
     B64Decode(secret64, *secret);
@@ -668,7 +668,7 @@ bool DNSPacket::checkForCorrectTSIG(UeberBackend* B, DNSName* keyname, string* s
     result = validateTSIG(d_rawpacket, tsigPos, tt, *trc, "", trc->d_mac, false);
   }
   catch(const std::runtime_error& err) {
-    L<<Logger::Error<<"Packet for '"<<this->qdomain<<"' denied: "<<err.what()<<endl;
+    g_log<<Logger::Error<<"Packet for '"<<this->qdomain<<"' denied: "<<err.what()<<endl;
     return false;
   }
 
index c9c0632728c42163b5b6d6957b5d4ff9b753da8e..34aeb688a07f691ff060fdae0ff7aed8ee326d9b 100644 (file)
@@ -78,7 +78,7 @@ DNSProxy::DNSProxy(const string &remote)
   }
 
   d_xor=dns_random(0xffff);
-  L<<Logger::Error<<"DNS Proxy launched, local port "<<ntohs(local.sin4.sin_port)<<", remote "<<d_remote.toStringWithPort()<<endl;
+  g_log<<Logger::Error<<"DNS Proxy launched, local port "<<ntohs(local.sin4.sin_port)<<", remote "<<d_remote.toStringWithPort()<<endl;
 } 
 
 void DNSProxy::go()
@@ -100,7 +100,7 @@ bool DNSProxy::completePacket(DNSPacket *r, const DNSName& target,const DNSName&
       ret2 = stubDoResolve(target, QType::AAAA, ips);
 
     if(ret1 != RCode::NoError || ret2 != RCode::NoError) {
-      L<<Logger::Error<<"Error resolving for ALIAS "<<target<<", returning SERVFAIL"<<endl;
+      g_log<<Logger::Error<<"Error resolving for ALIAS "<<target<<", returning SERVFAIL"<<endl;
     }
 
     for (auto &ip : ips)
@@ -141,7 +141,7 @@ bool DNSProxy::completePacket(DNSPacket *r, const DNSName& target,const DNSName&
   pw.getHeader()->id=id ^ d_xor;
 
   if(send(d_sock,&packet[0], packet.size() , 0)<0) { // zoom
-    L<<Logger::Error<<"Unable to send a packet to our recursing backend: "<<stringerror()<<endl;
+    g_log<<Logger::Error<<"Unable to send a packet to our recursing backend: "<<stringerror()<<endl;
   }
 
   return true;
@@ -160,7 +160,7 @@ int DNSProxy::getID_locked()
     }
     else if(i->second.created<time(0)-60) {
       if(i->second.created) {
-        L<<Logger::Warning<<"Recursive query for remote "<<
+        g_log<<Logger::Warning<<"Recursive query for remote "<<
           i->second.remote.toStringWithPort()<<" with internal id "<<n<<
           " was not answered by backend within timeout, reusing id"<<endl;
        delete i->second.complete;
@@ -187,16 +187,16 @@ void DNSProxy::mainloop(void)
       len=recvfrom(d_sock, buffer, sizeof(buffer),0, (struct sockaddr*) &fromaddr, &fromaddrSize); // answer from our backend
       if(len<(ssize_t)sizeof(dnsheader)) {
         if(len<0)
-          L<<Logger::Error<<"Error receiving packet from recursor backend: "<<stringerror()<<endl;
+          g_log<<Logger::Error<<"Error receiving packet from recursor backend: "<<stringerror()<<endl;
         else if(len==0)
-          L<<Logger::Error<<"Error receiving packet from recursor backend, EOF"<<endl;
+          g_log<<Logger::Error<<"Error receiving packet from recursor backend, EOF"<<endl;
         else
-          L<<Logger::Error<<"Short packet from recursor backend, "<<len<<" bytes"<<endl;
+          g_log<<Logger::Error<<"Short packet from recursor backend, "<<len<<" bytes"<<endl;
         
         continue;
       }
       if (fromaddr != d_remote) {
-        L<<Logger::Error<<"Got answer from unexpected host "<<fromaddr.toStringWithPort()<<" instead of our recursor backend "<<d_remote.toStringWithPort()<<endl;
+        g_log<<Logger::Error<<"Got answer from unexpected host "<<fromaddr.toStringWithPort()<<" instead of our recursor backend "<<d_remote.toStringWithPort()<<endl;
         continue;
       }
       (*d_resanswers)++;
@@ -211,12 +211,12 @@ void DNSProxy::mainloop(void)
 #endif
         map_t::iterator i=d_conntrack.find(d.id^d_xor);
         if(i==d_conntrack.end()) {
-          L<<Logger::Error<<"Discarding untracked packet from recursor backend with id "<<(d.id^d_xor)<<
+          g_log<<Logger::Error<<"Discarding untracked packet from recursor backend with id "<<(d.id^d_xor)<<
             ". Conntrack table size="<<d_conntrack.size()<<endl;
           continue;
         }
         else if(i->second.created==0) {
-          L<<Logger::Error<<"Received packet from recursor backend with id "<<(d.id^d_xor)<<" which is a duplicate"<<endl;
+          g_log<<Logger::Error<<"Received packet from recursor backend with id "<<(d.id^d_xor)<<" which is a duplicate"<<endl;
           continue;
         }
        
@@ -228,7 +228,7 @@ void DNSProxy::mainloop(void)
         q.parse(buffer,(size_t)len);
 
         if(p.qtype.getCode() != i->second.qtype || p.qdomain != i->second.qname) {
-          L<<Logger::Error<<"Discarding packet from recursor backend with id "<<(d.id^d_xor)<<
+          g_log<<Logger::Error<<"Discarding packet from recursor backend with id "<<(d.id^d_xor)<<
             ", qname or qtype mismatch ("<<p.qtype.getCode()<<" v " <<i->second.qtype<<", "<<p.qdomain<<" v "<<i->second.qname<<")"<<endl;
           continue;
         }
@@ -276,23 +276,23 @@ void DNSProxy::mainloop(void)
           addCMsgSrcAddr(&msgh, cbuf, i->second.anyLocal.get_ptr(), 0);
         }
         if(sendmsg(i->second.outsock, &msgh, 0) < 0)
-          L<<Logger::Warning<<"dnsproxy.cc: Error sending reply with sendmsg (socket="<<i->second.outsock<<"): "<<strerror(errno)<<endl;
+          g_log<<Logger::Warning<<"dnsproxy.cc: Error sending reply with sendmsg (socket="<<i->second.outsock<<"): "<<strerror(errno)<<endl;
         
         i->second.created=0;
       }
     }
   }
   catch(PDNSException &ae) {
-    L<<Logger::Error<<"Fatal error in DNS proxy: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"Fatal error in DNS proxy: "<<ae.reason<<endl;
   }
   catch(std::exception &e) {
-    L<<Logger::Error<<"Communicator thread died because of STL error: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Communicator thread died because of STL error: "<<e.what()<<endl;
   }
   catch( ... )
   {
-    L << Logger::Error << "Caught unknown exception." << endl;
+    g_log << Logger::Error << "Caught unknown exception." << endl;
   }
-  L<<Logger::Error<<"Exiting because DNS proxy failed"<<endl;
+  g_log<<Logger::Error<<"Exiting because DNS proxy failed"<<endl;
   _exit(1);
 }
 
index 64868b2d066b067db932c0d0a55760afe14458e2..a95a233f344de47f425b4c139ffdad83a73478e0 100644 (file)
@@ -71,8 +71,6 @@ What to do with timeouts. We keep around at most 65536 outstanding answers.
 #include "dnsrecords.hh"
 #include "ednssubnet.hh"
 #include "ednsoptions.hh"
-// this is needed because boost multi_index also uses 'L', as do we (which is sad enough)
-#undef L
 
 #include <set>
 #include <deque>
index 2fb712e2f332aab861c3096d729e52ab688f8504..703d9314d506fa98c309c5da34812d3fce623327 100644 (file)
@@ -28,8 +28,6 @@
 #include "sstuff.hh"
 #include "anadns.hh"
 
-// this is needed because boost multi_index also uses 'L', as do we (which is sad enough)
-#undef L
 
 #include <set>
 #include <deque>
index 864d4737427ac5cb65a5c9083d8e1c54a249da7c..af77f41325307ac84aa0195550785660f12e791f 100644 (file)
@@ -74,7 +74,7 @@ static void fillOutRRSIG(DNSSECPrivateKey& dpk, const DNSName& signQName, RRSIGR
 
     WriteLock l(&g_signatures_lock);
     if(g_cacheweekno < weekno || g_signatures.size() >= (uint) maxcachesize) {  // blunt but effective (C) Habbie, mind04
-      L<<Logger::Warning<<"Cleared signature cache."<<endl;
+      g_log<<Logger::Warning<<"Cleared signature cache."<<endl;
       g_signatures.clear();
       g_cacheweekno = weekno;
     }
index 3d681cd2a09da2846d2116af874a2cc49f8b8c45..44564b23143eb4a0e5564e719aa27c558cf61eaf 100644 (file)
@@ -56,7 +56,7 @@ string DLQuitHandler(const vector<string>&parts, Utility::pid_t ppid)
   if(parts[0]=="QUIT") {
     s_pleasequit=true;
     ret="Scheduling exit";
-    L<<Logger::Error<<"Scheduling exit on remote request"<<endl;
+    g_log<<Logger::Error<<"Scheduling exit on remote request"<<endl;
   }
   return ret;
 }
@@ -278,7 +278,7 @@ string DLNotifyHostHandler(const vector<string>&parts, Utility::pid_t ppid)
     return "Unable to convert '"+parts[2]+"' to an IP address";
   }
   
-  L<<Logger::Warning<<"Notification request to host "<<parts[2]<<" for domain '"<<domain<<"' received from operator"<<endl;
+  g_log<<Logger::Warning<<"Notification request to host "<<parts[2]<<" for domain '"<<domain<<"' received from operator"<<endl;
   Communicator.notify(domain, parts[2]);
   return "Added to queue";
 }
@@ -291,7 +291,7 @@ string DLNotifyHandler(const vector<string>&parts, Utility::pid_t ppid)
     return "syntax: notify domain";
   if(!::arg().mustDo("master") && !::arg().mustDo("slave-renotify"))
       return "PowerDNS not configured as master or slave with re-notifications";
-  L<<Logger::Warning<<"Notification request for domain '"<<parts[1]<<"' received from operator"<<endl;
+  g_log<<Logger::Warning<<"Notification request for domain '"<<parts[1]<<"' received from operator"<<endl;
 
   if (parts[1] == "*") {
     vector<DomainInfo> domains;
@@ -327,7 +327,7 @@ string DLRediscoverHandler(const vector<string>&parts, Utility::pid_t ppid)
 {
   UeberBackend B;
   try {
-    L<<Logger::Error<<"Rediscovery was requested"<<endl;
+    g_log<<Logger::Error<<"Rediscovery was requested"<<endl;
     string status="Ok";
     B.rediscover(&status);
     return status;
@@ -342,7 +342,7 @@ string DLReloadHandler(const vector<string>&parts, Utility::pid_t ppid)
 {
   UeberBackend B;
   B.reload();
-  L<<Logger::Error<<"Reload was requested"<<endl;
+  g_log<<Logger::Error<<"Reload was requested"<<endl;
   return "Ok";
 }
 
@@ -350,7 +350,7 @@ string DLReloadHandler(const vector<string>&parts, Utility::pid_t ppid)
 string DLListZones(const vector<string>&parts, Utility::pid_t ppid)
 {
   UeberBackend B;
-  L<<Logger::Notice<<"Received request to list zones."<<endl;
+  g_log<<Logger::Notice<<"Received request to list zones."<<endl;
   vector<DomainInfo> domains;
   B.getAllDomains(&domains);
   ostringstream ret;
index 8de1c191e9806da29433c2d5d8e729ad35fae663..04bf537c103cdda167aef645a6a7369ffd0f61c5 100644 (file)
@@ -71,9 +71,9 @@ void DynListener::createSocketAndBind(int family, struct sockaddr*local, size_t
 
   if(d_s < 0) {
     if (family == AF_UNIX)
-      L<<Logger::Error<<"Unable to create control socket at '"<<((struct sockaddr_un*)local)->sun_path<<"', reason: "<<strerror(errno)<<endl;
+      g_log<<Logger::Error<<"Unable to create control socket at '"<<((struct sockaddr_un*)local)->sun_path<<"', reason: "<<strerror(errno)<<endl;
     else
-      L<<Logger::Error<<"Unable to create control socket on '"<<((ComboAddress *)local)->toStringWithPort()<<"', reason: "<<strerror(errno)<<endl;
+      g_log<<Logger::Error<<"Unable to create control socket on '"<<((ComboAddress *)local)->toStringWithPort()<<"', reason: "<<strerror(errno)<<endl;
     exit(1);
   }
   
@@ -83,9 +83,9 @@ void DynListener::createSocketAndBind(int family, struct sockaddr*local, size_t
     
   if(bind(d_s, local, len) < 0) {
     if (family == AF_UNIX)
-      L<<Logger::Critical<<"Unable to bind to control socket at '"<<((struct sockaddr_un*)local)->sun_path<<"', reason: "<<strerror(errno)<<endl;
+      g_log<<Logger::Critical<<"Unable to bind to control socket at '"<<((struct sockaddr_un*)local)->sun_path<<"', reason: "<<strerror(errno)<<endl;
     else
-      L<<Logger::Critical<<"Unable to bind to control socket on '"<<((ComboAddress *)local)->toStringWithPort()<<"', reason: "<<strerror(errno)<<endl;
+      g_log<<Logger::Critical<<"Unable to bind to control socket on '"<<((ComboAddress *)local)->toStringWithPort()<<"', reason: "<<strerror(errno)<<endl;
     exit(1);
   }
 }
@@ -102,7 +102,7 @@ bool DynListener::testLive(const string& fname)
   }
 
   if (makeUNsockaddr(fname, &addr)) {
-    L<<Logger::Critical<<"Unable to open controlsocket, path '"<<fname<<"' is not a valid UNIX socket path."<<endl;
+    g_log<<Logger::Critical<<"Unable to open controlsocket, path '"<<fname<<"' is not a valid UNIX socket path."<<endl;
     exit(1);
   }
 
@@ -114,18 +114,18 @@ bool DynListener::testLive(const string& fname)
 void DynListener::listenOnUnixDomain(const string& fname)
 {
   if(testLive(fname)) {
-    L<<Logger::Critical<<"Previous controlsocket '"<<fname<<"' is in use"<<endl;
+    g_log<<Logger::Critical<<"Previous controlsocket '"<<fname<<"' is in use"<<endl;
     exit(1);
   }
   int err=unlink(fname.c_str());
   if(err < 0 && errno!=ENOENT) {
-    L<<Logger::Critical<<"Unable to remove (previous) controlsocket at '"<<fname<<"': "<<strerror(errno)<<endl;
+    g_log<<Logger::Critical<<"Unable to remove (previous) controlsocket at '"<<fname<<"': "<<strerror(errno)<<endl;
     exit(1);
   }
 
   struct sockaddr_un local;
   if (makeUNsockaddr(fname, &local)) {
-    L<<Logger::Critical<<"Unable to bind to controlsocket, path '"<<fname<<"' is not a valid UNIX socket path."<<endl;
+    g_log<<Logger::Critical<<"Unable to bind to controlsocket, path '"<<fname<<"' is not a valid UNIX socket path."<<endl;
     exit(1);
   }
   
@@ -133,14 +133,14 @@ void DynListener::listenOnUnixDomain(const string& fname)
   d_socketname=fname;
   if(!arg()["setgid"].empty()) {
     if(chmod(fname.c_str(),0660)<0)
-      L<<Logger::Error<<"Unable to change group access mode of controlsocket at '"<<fname<<"', reason: "<<strerror(errno)<<endl;
+      g_log<<Logger::Error<<"Unable to change group access mode of controlsocket at '"<<fname<<"', reason: "<<strerror(errno)<<endl;
     if(chown(fname.c_str(),static_cast<uid_t>(-1),Utility::makeGidNumeric(arg()["setgid"]))<0)
-      L<<Logger::Error<<"Unable to change group ownership of controlsocket at '"<<fname<<"', reason: "<<strerror(errno)<<endl;
+      g_log<<Logger::Error<<"Unable to change group ownership of controlsocket at '"<<fname<<"', reason: "<<strerror(errno)<<endl;
   }
   
   listen(d_s, 10);
   
-  L<<Logger::Warning<<"Listening on controlsocket in '"<<fname<<"'"<<endl;
+  g_log<<Logger::Warning<<"Listening on controlsocket in '"<<fname<<"'"<<endl;
   d_nonlocal=true;
 }
 
@@ -154,12 +154,12 @@ void DynListener::listenOnTCP(const ComboAddress& local)
   listen(d_s, 10);
 
   d_socketaddress=local;
-  L<<Logger::Warning<<"Listening on controlsocket on '"<<local.toStringWithPort()<<"'"<<endl;
+  g_log<<Logger::Warning<<"Listening on controlsocket on '"<<local.toStringWithPort()<<"'"<<endl;
   d_nonlocal=true;
 
   if(!::arg()["tcp-control-range"].empty()) {
     d_tcprange.toMasks(::arg()["tcp-control-range"]);
-    L<<Logger::Warning<<"Only allowing TCP control from: "<<d_tcprange.toString()<<endl;
+    g_log<<Logger::Warning<<"Only allowing TCP control from: "<<d_tcprange.toString()<<endl;
   }
 }
 
@@ -194,9 +194,9 @@ DynListener::DynListener(const string &progname)
     cleanSlashes(socketname);
     
     if(!mkdir(socketname.c_str(),0700)) // make /var directory, if needed
-      L<<Logger::Warning<<"Created local state directory '"<<socketname<<"'"<<endl;
+      g_log<<Logger::Warning<<"Created local state directory '"<<socketname<<"'"<<endl;
     else if(errno!=EEXIST) {
-      L<<Logger::Critical<<"Unable to create socket directory ("<<socketname<<") and it does not exist yet"<<endl;
+      g_log<<Logger::Critical<<"Unable to create socket directory ("<<socketname<<") and it does not exist yet"<<endl;
       exit(1);
     }
     
@@ -218,7 +218,7 @@ void *DynListener::theListenerHelper(void *p)
 {
   DynListener *us=static_cast<DynListener *>(p);
   us->theListener();
-  L<<Logger::Error<<"Control listener aborted, please file a bug!"<<endl;
+  g_log<<Logger::Error<<"Control listener aborted, please file a bug!"<<endl;
   return 0;
 }
 
@@ -237,12 +237,12 @@ string DynListener::getLine()
       d_client=accept(d_s,(sockaddr*)&remote,&remlen);
       if(d_client<0) {
         if(errno!=EINTR)
-          L<<Logger::Error<<"Unable to accept controlsocket connection ("<<d_s<<"): "<<strerror(errno)<<endl;
+          g_log<<Logger::Error<<"Unable to accept controlsocket connection ("<<d_s<<"): "<<strerror(errno)<<endl;
         continue;
       }
 
       if(d_tcp && !d_tcprange.match(&remote)) { // checks if the remote is within the permitted range.
-        L<<Logger::Error<<"Access denied to remote "<<remote.toString()<<" because not allowed"<<endl;
+        g_log<<Logger::Error<<"Access denied to remote "<<remote.toString()<<" because not allowed"<<endl;
         writen2(d_client, "Access denied to "+remote.toString()+"\n");
         close(d_client);
         continue;
@@ -251,14 +251,14 @@ string DynListener::getLine()
       std::shared_ptr<FILE> fp=std::shared_ptr<FILE>(fdopen(dup(d_client), "r"), fclose);
       if(d_tcp) {
         if(!fgets(&mesg[0], mesg.size(), fp.get())) {
-          L<<Logger::Error<<"Unable to receive password from controlsocket ("<<d_client<<"): "<<strerror(errno)<<endl;
+          g_log<<Logger::Error<<"Unable to receive password from controlsocket ("<<d_client<<"): "<<strerror(errno)<<endl;
           close(d_client);
           continue;
         }
         string password(&mesg[0]);
         boost::trim(password);
         if(password.empty() || password!=arg()["tcp-control-secret"]) {
-          L<<Logger::Error<<"Wrong password on TCP control socket"<<endl;
+          g_log<<Logger::Error<<"Wrong password on TCP control socket"<<endl;
           writen2(d_client, "Wrong password");
 
           close(d_client);
@@ -268,13 +268,13 @@ string DynListener::getLine()
       errno=0;
       if(!fgets(&mesg[0], mesg.size(), fp.get())) {
         if(errno)
-          L<<Logger::Error<<"Unable to receive line from controlsocket ("<<d_client<<"): "<<strerror(errno)<<endl;
+          g_log<<Logger::Error<<"Unable to receive line from controlsocket ("<<d_client<<"): "<<strerror(errno)<<endl;
         close(d_client);
         continue;
       }
       
       if(strlen(&mesg[0]) == mesg.size()) {
-        L<<Logger::Error<<"Line on controlsocket ("<<d_client<<") was too long"<<endl;
+        g_log<<Logger::Error<<"Line on controlsocket ("<<d_client<<") was too long"<<endl;
         close(d_client);
         continue;
       }
@@ -308,7 +308,7 @@ void DynListener::sendlines(const string &l)
       ret=send(d_client, l.c_str()+sent, l.length()-sent, 0); 
 
       if(ret<0 || !ret) {
-        L<<Logger::Error<<"Error sending data to pdns_control: "<<stringerror()<<endl;
+        g_log<<Logger::Error<<"Error sending data to pdns_control: "<<stringerror()<<endl;
         break;
       }
       sent+=ret;
@@ -321,7 +321,7 @@ void DynListener::sendlines(const string &l)
     lines.append(1, '\0');
     lines.append(1, '\n');
     if((unsigned int)write(1, lines.c_str(), lines.length()) != lines.length())
-      L<<Logger::Error<<"Error sending data to console: "<<stringerror()<<endl;
+      g_log<<Logger::Error<<"Error sending data to console: "<<stringerror()<<endl;
   }
 }
 
@@ -364,30 +364,30 @@ void DynListener::theListener()
           sendlines("Unknown command: '"+parts[0]+"'");
       }
       catch(PDNSException &AE) {
-        L<<Logger::Error<<"Non-fatal error in control listener command '"<<line<<"': "<<AE.reason<<endl;
+        g_log<<Logger::Error<<"Non-fatal error in control listener command '"<<line<<"': "<<AE.reason<<endl;
       }
       catch(string &E) {
-        L<<Logger::Error<<"Non-fatal error 2 in control listener command '"<<line<<"': "<<E<<endl;
+        g_log<<Logger::Error<<"Non-fatal error 2 in control listener command '"<<line<<"': "<<E<<endl;
       }
       catch(std::exception& e) {
-        L<<Logger::Error<<"Non-fatal STL error in control listener command '"<<line<<"': "<<e.what()<<endl;
+        g_log<<Logger::Error<<"Non-fatal STL error in control listener command '"<<line<<"': "<<e.what()<<endl;
       }
       catch(...) {
-        L<<Logger::Error<<"Non-fatal error in control listener command '"<<line<<"': unknown exception occurred"<<endl;
+        g_log<<Logger::Error<<"Non-fatal error in control listener command '"<<line<<"': unknown exception occurred"<<endl;
       }
     }
   }
   catch(PDNSException &AE) {
-    L<<Logger::Error<<"Fatal error in control listener: "<<AE.reason<<endl;
+    g_log<<Logger::Error<<"Fatal error in control listener: "<<AE.reason<<endl;
   }
   catch(string &E) {
-    L<<Logger::Error<<"Fatal error 2 in control listener: "<<E<<endl;
+    g_log<<Logger::Error<<"Fatal error 2 in control listener: "<<E<<endl;
   }
   catch(std::exception& e) {
-    L<<Logger::Error<<"Fatal STL error in control listener: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Fatal STL error in control listener: "<<e.what()<<endl;
   }
   catch(...) {
-    L<<Logger::Error<<"Fatal: unknown exception in control listener occurred"<<endl;
+    g_log<<Logger::Error<<"Fatal: unknown exception in control listener occurred"<<endl;
   }
 }
 
index 55c54be6d7615958206b6abc666676a3378d88df..8ef1061cce70e6ed7c95c52cf854585da393c8c8 100644 (file)
@@ -456,17 +456,17 @@ bool gss_add_signature(const DNSName& context, const std::string& message, std::
   string tmp_mac;
   GssContext gssctx(context);
   if (!gssctx.valid()) {
-    L<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl;
+    g_log<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl;
     for(const string& error :  gssctx.getErrorStrings()) {
-       L<<Logger::Error<<"GSS error: "<<error<<endl;;
+       g_log<<Logger::Error<<"GSS error: "<<error<<endl;;
     }
     return false;
   }
 
   if (!gssctx.sign(message, tmp_mac)) {
-    L<<Logger::Error<<"Could not sign message using GSS context '"<<context<<"'"<<endl;
+    g_log<<Logger::Error<<"Could not sign message using GSS context '"<<context<<"'"<<endl;
     for(const string& error :  gssctx.getErrorStrings()) {
-       L<<Logger::Error<<"GSS error: "<<error<<endl;;
+       g_log<<Logger::Error<<"GSS error: "<<error<<endl;;
     }
     return false;
   }
@@ -477,17 +477,17 @@ bool gss_add_signature(const DNSName& context, const std::string& message, std::
 bool gss_verify_signature(const DNSName& context, const std::string& message, const std::string& mac) {
   GssContext gssctx(context);
   if (!gssctx.valid()) {
-    L<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl;
+    g_log<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl;
     for(const string& error :  gssctx.getErrorStrings()) {
-       L<<Logger::Error<<"GSS error: "<<error<<endl;;
+       g_log<<Logger::Error<<"GSS error: "<<error<<endl;;
     }
     return false;
   }
 
   if (!gssctx.verify(message, mac)) {
-    L<<Logger::Error<<"Could not verify message using GSS context '"<<context<<"'"<<endl;
+    g_log<<Logger::Error<<"Could not verify message using GSS context '"<<context<<"'"<<endl;
     for(const string& error :  gssctx.getErrorStrings()) {
-       L<<Logger::Error<<"GSS error: "<<error<<endl;;
+       g_log<<Logger::Error<<"GSS error: "<<error<<endl;;
     }
     return false;
   }
index 01eb6e4045abd5826a99bb1fe54a273c879225dd..484768ffe73889f0945427fef34ee60a103f3be6 100644 (file)
@@ -32,15 +32,9 @@ extern StatBag S;
 #include "namespaces.hh"
 
 pthread_once_t Logger::s_once;
-pthread_key_t Logger::s_loggerKey;
+pthread_key_t Logger::g_loggerKey;
 
-Logger &theL(const string &pname)
-{
-  static Logger l("", LOG_DAEMON);
-  if(!pname.empty())
-    l.setName(pname);
-  return l;
-}
+Logger g_log("", LOG_DAEMON);
 
 void Logger::log(const string &msg, Urgency u)
 {
@@ -104,7 +98,7 @@ void Logger::setName(const string &_name)
 
 void Logger::initKey()
 {
-  if(pthread_key_create(&s_loggerKey, perThreadDestructor))
+  if(pthread_key_create(&g_loggerKey, perThreadDestructor))
     unixDie("Creating thread key for logger");
 }
 
@@ -139,13 +133,13 @@ void Logger::perThreadDestructor(void* buf)
 
 Logger::PerThread* Logger::getPerThread()
 {
-  void *buf=pthread_getspecific(s_loggerKey);
+  void *buf=pthread_getspecific(g_loggerKey);
   PerThread* ret;
   if(buf)
     ret = (PerThread*) buf;
   else {
     ret = new PerThread();
-    pthread_setspecific(s_loggerKey, (void*)ret);
+    pthread_setspecific(g_loggerKey, (void*)ret);
   }
   return ret;
 }
index 989c921fcfcbbe138bc8959c64d5b1fc4b581c52..5cd9e18e8eb5d0ae28e71f024f2baa6a2560a760 100644 (file)
@@ -70,9 +70,9 @@ public:
   void resetFlags(){flags=0;open();} //!< zero the flags
   /** Use this to stream to your log, like this:
       \code
-      L<<"This is an informational message"<<endl; // logged at default loglevel (Info)
-      L<<Logger::Warning<<"Out of diskspace"<<endl; // Logged as a warning 
-      L<<"This is an informational message"<<endl; // logged AGAIN at default loglevel (Info)
+      g_log<<"This is an informational message"<<endl; // logged at default loglevel (Info)
+      g_log<<Logger::Warning<<"Out of diskspace"<<endl; // Logged as a warning 
+      g_log<<"This is an informational message"<<endl; // logged AGAIN at default loglevel (Info)
       \endcode
   */
   Logger& operator<<(const char *s);
@@ -113,10 +113,10 @@ private:
   bool d_disableSyslog;
   bool d_timestamps{true};
   static pthread_once_t s_once;
-  static pthread_key_t s_loggerKey;
+  static pthread_key_t g_loggerKey;
 };
 
-extern Logger &theL(const string &pname="");
+extern Logger g_log;
 
 #ifdef VERBOSELOG
 #define DLOG(x) x
index f7a3414ad1cee87c192028ef5f789e703697869c..b89e50e6d33ea4b5c87fe41cc9e8e0ce8e9195ae 100644 (file)
@@ -27,7 +27,6 @@ void AuthLua4::postLoad()
 
 #else
 
-#undef L
 #include "ext/luawrapper/include/LuaContext.hpp"
 
 void AuthLua4::postPrepareContext() {
index 6e0e1e556804ee11ef9e181049c6bf9ab81138d9..2da3ddfd20bd89825d481471c63c2ddb08e897f8 100644 (file)
@@ -17,7 +17,7 @@ BaseLua4::BaseLua4() {
 void BaseLua4::loadFile(const std::string &fname) {
   std::ifstream ifs(fname);
   if(!ifs) {
-    theL()<<Logger::Error<<"Unable to read configuration file from '"<<fname<<"': "<<strerror(errno)<<endl;
+    g_log<<Logger::Error<<"Unable to read configuration file from '"<<fname<<"': "<<strerror(errno)<<endl;
     return;
   }
   loadStream(ifs);
@@ -36,7 +36,6 @@ BaseLua4::~BaseLua4() { }
 
 #else
 
-#undef L
 #include "ext/luawrapper/include/LuaContext.hpp"
 
 void BaseLua4::prepareContext() {
@@ -139,7 +138,7 @@ void BaseLua4::prepareContext() {
       else
         cas.insert(boost::get<ComboAddress>(in));
       }
-      catch(std::exception& e) { theL() <<Logger::Error<<e.what()<<endl; }
+      catch(std::exception& e) { g_log <<Logger::Error<<e.what()<<endl; }
     });
   d_lw->registerFunction<bool(cas_t::*)(const ComboAddress&)>("check",[](const cas_t& cas, const ComboAddress&ca) { return cas.count(ca)>0; });
   d_lw->registerFunction<bool(ComboAddress::*)(const ComboAddress&)>("equal", [](const ComboAddress& lhs, const ComboAddress& rhs) { return ComboAddress::addressOnlyEqual()(lhs, rhs); });
@@ -189,7 +188,7 @@ void BaseLua4::prepareContext() {
   d_lw->registerFunction<void(DNSRecord::*)(const std::string&)>("changeContent", [](DNSRecord& dr, const std::string& newContent) { dr.d_content = shared_ptr<DNSRecordContent>(DNSRecordContent::mastermake(dr.d_type, 1, newContent)); });
 
   // pdnsload
-  d_lw->writeFunction("pdnslog", [](const std::string& msg, boost::optional<int> loglevel) { theL() << (Logger::Urgency)loglevel.get_value_or(Logger::Warning) << msg<<endl; });
+  d_lw->writeFunction("pdnslog", [](const std::string& msg, boost::optional<int> loglevel) { g_log << (Logger::Urgency)loglevel.get_value_or(Logger::Warning) << msg<<endl; });
 
   // certain constants
   d_pd.push_back({"PASS", (int)PolicyDecision::PASS});
index cd2fd2631b52b875f6a0b61d0a47015874fb4900..c166e3f56fc1595be43a4b59818ae492d6654f33 100644 (file)
@@ -8,9 +8,7 @@
 class LuaContext;
 
 #if defined(HAVE_LUA)
-#undef L
 #include "ext/luawrapper/include/LuaContext.hpp"
-#define L theL()
 #endif
 
 class BaseLua4 : public boost::noncopyable
index 7d713d0f457697c46fdcffd558ddc0f257375b27..746346ee184d57c4717326076773b91cf74fd154 100644 (file)
@@ -337,7 +337,7 @@ void RecursorLua4::postPrepareContext()
         }
       }
       catch(std::exception& e) {
-        theL() <<Logger::Error<<e.what()<<endl;
+        g_log <<Logger::Error<<e.what()<<endl;
       }
     }
   );
@@ -563,7 +563,7 @@ loop:;
         dq.udpAnswer = GenUDPQueryResponse(dq.udpQueryDest, dq.udpQuery);
         auto cbFunc = d_lw->readVariable<boost::optional<luacall_t>>(dq.udpCallback).get_value_or(0);
         if(!cbFunc) {
-          theL()<<Logger::Error<<"Attempted callback for Lua UDP Query/Response which could not be found"<<endl;
+          g_log<<Logger::Error<<"Attempted callback for Lua UDP Query/Response which could not be found"<<endl;
           return false;
         }
         bool result=cbFunc(&dq);
index 6c045a8b9e76c4accf1fd134791a4c30a7a40ed6..5d189689e3f83b7aec2b2967cdf28649af74d654 100644 (file)
@@ -236,7 +236,7 @@ int asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool d
 
     if(domain != mdp.d_qname) { 
       if(!mdp.d_qname.empty() && domain.toString().find((char)0) == string::npos /* ugly */) {// embedded nulls are too noisy, plus empty domains are too
-        L<<Logger::Notice<<"Packet purporting to come from remote server "<<ip.toString()<<" contained wrong answer: '" << domain << "' != '" << mdp.d_qname << "'" << endl;
+        g_log<<Logger::Notice<<"Packet purporting to come from remote server "<<ip.toString()<<" contained wrong answer: '" << domain << "' != '" << mdp.d_qname << "'" << endl;
       }
       // unexpected count has already been done @ pdns_recursor.cc
       goto out;
@@ -276,7 +276,7 @@ int asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool d
   }
   catch(std::exception &mde) {
     if(::arg().mustDo("log-common-errors"))
-      L<<Logger::Notice<<"Unable to parse packet from remote server "<<ip.toString()<<": "<<mde.what()<<endl;
+      g_log<<Logger::Notice<<"Unable to parse packet from remote server "<<ip.toString()<<": "<<mde.what()<<endl;
     lwr->d_rcode = RCode::FormErr;
     g_stats.serverParseError++;
 #ifdef HAVE_PROTOBUF
@@ -287,7 +287,7 @@ int asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool d
     return 1; // success - oddly enough
   }
   catch(...) {
-    L<<Logger::Notice<<"Unknown error parsing packet from remote server"<<endl;
+    g_log<<Logger::Notice<<"Unknown error parsing packet from remote server"<<endl;
   }
   
   g_stats.serverParseError++; 
index ce227c7dd1b98480f1723e68fa15bab8a67b6d64..17a4ff8baf1b08a9a8c4b2e53f916d2ff3fb3aac 100644 (file)
@@ -58,13 +58,13 @@ void CommunicatorClass::queueNotifyDomain(const DomainInfo& di, UeberBackend* B)
     for(set<string>::const_iterator j=nsset.begin();j!=nsset.end();++j) {
       vector<string> nsips=fns.lookup(DNSName(*j), B);
       if(nsips.empty())
-        L<<Logger::Warning<<"Unable to queue notification of domain '"<<di.zone<<"': nameservers do not resolve!"<<endl;
+        g_log<<Logger::Warning<<"Unable to queue notification of domain '"<<di.zone<<"': nameservers do not resolve!"<<endl;
       else
         for(vector<string>::const_iterator k=nsips.begin();k!=nsips.end();++k) {
           const ComboAddress caIp(*k, 53);
           if(!d_preventSelfNotification || !AddressIsUs(caIp)) {
             if(!d_onlyNotify.match(&caIp))
-              L<<Logger::Info<<"Skipped notification of domain '"<<di.zone<<"' to "<<*j<<" because it does not match only-notify."<<endl;
+              g_log<<Logger::Info<<"Skipped notification of domain '"<<di.zone<<"' to "<<*j<<" because it does not match only-notify."<<endl;
             else
               ips.insert(caIp.toStringWithPort());
           }
@@ -72,7 +72,7 @@ void CommunicatorClass::queueNotifyDomain(const DomainInfo& di, UeberBackend* B)
     }
 
     for(set<string>::const_iterator j=ips.begin();j!=ips.end();++j) {
-      L<<Logger::Warning<<"Queued notification of domain '"<<di.zone<<"' to "<<*j<<endl;
+      g_log<<Logger::Warning<<"Queued notification of domain '"<<di.zone<<"' to "<<*j<<endl;
       d_nq.add(di.zone,*j);
       hasQueuedItem=true;
     }
@@ -84,7 +84,7 @@ void CommunicatorClass::queueNotifyDomain(const DomainInfo& di, UeberBackend* B)
   for(set<string>::const_iterator j=alsoNotify.begin();j!=alsoNotify.end();++j) {
     try {
       const ComboAddress caIp(*j, 53);
-      L<<Logger::Warning<<"Queued also-notification of domain '"<<di.zone<<"' to "<<caIp.toStringWithPort()<<endl;
+      g_log<<Logger::Warning<<"Queued also-notification of domain '"<<di.zone<<"' to "<<caIp.toStringWithPort()<<endl;
       if (!ips.count(caIp.toStringWithPort())) {
         ips.insert(caIp.toStringWithPort());
         d_nq.add(di.zone, caIp.toStringWithPort());
@@ -92,12 +92,12 @@ void CommunicatorClass::queueNotifyDomain(const DomainInfo& di, UeberBackend* B)
       hasQueuedItem=true;
     }
     catch(PDNSException &e) {
-      L<<Logger::Warning<<"Unparseable IP in ALSO-NOTIFY metadata of domain '"<<di.zone<<"'. Warning: "<<e.reason<<endl;
+      g_log<<Logger::Warning<<"Unparseable IP in ALSO-NOTIFY metadata of domain '"<<di.zone<<"'. Warning: "<<e.reason<<endl;
     }
   }
 
   if (!hasQueuedItem)
-    L<<Logger::Warning<<"Request to queue notification for domain '"<<di.zone<<"' was processed, but no valid nameservers or ALSO-NOTIFYs found. Not notifying!"<<endl;
+    g_log<<Logger::Warning<<"Request to queue notification for domain '"<<di.zone<<"' was processed, but no valid nameservers or ALSO-NOTIFYs found. Not notifying!"<<endl;
 }
 
 
@@ -106,7 +106,7 @@ bool CommunicatorClass::notifyDomain(const DNSName &domain)
   DomainInfo di;
   UeberBackend B;
   if(!B.getDomainInfo(domain, di)) {
-    L<<Logger::Error<<"No such domain '"<<domain<<"' in our database"<<endl;
+    g_log<<Logger::Error<<"No such domain '"<<domain<<"' in our database"<<endl;
     return false;
   }
   queueNotifyDomain(di, &B);
@@ -135,12 +135,12 @@ void CommunicatorClass::masterUpdateCheck(PacketHandler *P)
   
   if(cmdomains.empty()) {
     if(d_masterschanged)
-      L<<Logger::Warning<<"No master domains need notifications"<<endl;
+      g_log<<Logger::Warning<<"No master domains need notifications"<<endl;
     d_masterschanged=false;
   }
   else {
     d_masterschanged=true;
-    L<<Logger::Error<<cmdomains.size()<<" domain"<<(cmdomains.size()>1 ? "s" : "")<<" for which we are master need"<<
+    g_log<<Logger::Error<<cmdomains.size()<<" domain"<<(cmdomains.size()>1 ? "s" : "")<<" for which we are master need"<<
       (cmdomains.size()>1 ? "" : "s")<<
       " notifications"<<endl;
   }
@@ -175,17 +175,17 @@ time_t CommunicatorClass::doNotifications()
     p.setRemote(&from);
 
     if(p.parse(buffer,(size_t)size)<0) {
-      L<<Logger::Warning<<"Unable to parse SOA notification answer from "<<p.getRemote()<<endl;
+      g_log<<Logger::Warning<<"Unable to parse SOA notification answer from "<<p.getRemote()<<endl;
       continue;
     }
 
     if(p.d.rcode)
-      L<<Logger::Warning<<"Received unsuccessful notification report for '"<<p.qdomain<<"' from "<<from.toStringWithPort()<<", error: "<<RCode::to_s(p.d.rcode)<<endl;      
+      g_log<<Logger::Warning<<"Received unsuccessful notification report for '"<<p.qdomain<<"' from "<<from.toStringWithPort()<<", error: "<<RCode::to_s(p.d.rcode)<<endl;      
 
     if(d_nq.removeIf(from.toStringWithPort(), p.d.id, p.qdomain))
-      L<<Logger::Warning<<"Removed from notification list: '"<<p.qdomain<<"' to "<<from.toStringWithPort()<<" "<< (p.d.rcode ? RCode::to_s(p.d.rcode) : "(was acknowledged)")<<endl;      
+      g_log<<Logger::Warning<<"Removed from notification list: '"<<p.qdomain<<"' to "<<from.toStringWithPort()<<" "<< (p.d.rcode ? RCode::to_s(p.d.rcode) : "(was acknowledged)")<<endl;      
     else {
-      L<<Logger::Warning<<"Received spurious notify answer for '"<<p.qdomain<<"' from "<< from.toStringWithPort()<<endl;
+      g_log<<Logger::Warning<<"Received spurious notify answer for '"<<p.qdomain<<"' from "<< from.toStringWithPort()<<endl;
       //d_nq.dump();
     }
   }
@@ -202,7 +202,7 @@ time_t CommunicatorClass::doNotifications()
         ComboAddress remote(ip, 53); // default to 53
         if((d_nsock6 < 0 && remote.sin4.sin_family == AF_INET6) ||
            (d_nsock4 < 0 && remote.sin4.sin_family == AF_INET)) {
-             L<<Logger::Warning<<"Unable to notify "<<remote.toStringWithPort()<<" for domain '"<<domain<<"', address family is disabled. Is query-local-address"<<(remote.sin4.sin_family == AF_INET ? "" : "6")<<" unset?"<<endl;
+             g_log<<Logger::Warning<<"Unable to notify "<<remote.toStringWithPort()<<" for domain '"<<domain<<"', address family is disabled. Is query-local-address"<<(remote.sin4.sin_family == AF_INET ? "" : "6")<<" unset?"<<endl;
              d_nq.removeIf(remote.toStringWithPort(), id, domain); // Remove, we'll never be able to notify
              continue; // don't try to notify what we can't!
         }
@@ -213,11 +213,11 @@ time_t CommunicatorClass::doNotifications()
         drillHole(domain, ip);
       }
       catch(ResolverException &re) {
-        L<<Logger::Error<<"Error trying to resolve '"<<ip<<"' for notifying '"<<domain<<"' to server: "<<re.reason<<endl;
+        g_log<<Logger::Error<<"Error trying to resolve '"<<ip<<"' for notifying '"<<domain<<"' to server: "<<re.reason<<endl;
       }
     }
     else
-      L<<Logger::Error<<"Notification for "<<domain<<" to "<<ip<<" failed after retries"<<endl;
+      g_log<<Logger::Error<<"Notification for "<<domain<<" to "<<ip<<" failed after retries"<<endl;
   }
 
   return d_nq.earliest();
@@ -243,7 +243,7 @@ void CommunicatorClass::sendNotification(int sock, const DNSName& domain, const
 
   if (tsigkeyname.empty() == false) {
     if (!B.getTSIGKey(tsigkeyname, &tsigalgorithm, &tsigsecret64)) {
-      L<<Logger::Error<<"TSIG key '"<<tsigkeyname<<"' for domain '"<<domain<<"' not found"<<endl;
+      g_log<<Logger::Error<<"TSIG key '"<<tsigkeyname<<"' for domain '"<<domain<<"' not found"<<endl;
       return;
     }
     TSIGRecordContent trc;
@@ -256,7 +256,7 @@ void CommunicatorClass::sendNotification(int sock, const DNSName& domain, const
     trc.d_origID=ntohs(id);
     trc.d_eRcode=0;
     if (B64Decode(tsigsecret64, tsigsecret) == -1) {
-      L<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<tsigkeyname<<"' for domain '"<<domain<<"'"<<endl;
+      g_log<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<tsigkeyname<<"' for domain '"<<domain<<"'"<<endl;
       return;
     }
     addTSIG(pw, trc, tsigkeyname, tsigsecret, "", false);
index 2c0501de3938627cd015cc3855c910d6d6faf06b..bfcf5646ea14d57634edd553cf157e06708770bd 100644 (file)
@@ -103,7 +103,7 @@ void UDPNameserver::bindIPv4()
     s=socket(AF_INET,SOCK_DGRAM,0);
 
     if(s<0) {
-      L<<Logger::Error<<"Unable to acquire UDP socket: "+string(strerror(errno)) << endl;
+      g_log<<Logger::Error<<"Unable to acquire UDP socket: "+string(strerror(errno)) << endl;
       throw PDNSException("Unable to acquire a UDP socket: "+string(strerror(errno)));
     }
   
@@ -119,7 +119,7 @@ void UDPNameserver::bindIPv4()
       setsockopt(s, IPPROTO_IP, GEN_IP_PKTINFO, &one, sizeof(one));
 
     if (!setSocketTimestamps(s))
-      L<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
+      g_log<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
 
 #ifdef SO_REUSEPORT
     if( d_can_reuseport )
@@ -141,15 +141,15 @@ void UDPNameserver::bindIPv4()
       string binderror = strerror(errno);
       close(s);
       if( errno == EADDRNOTAVAIL && ! ::arg().mustDo("local-address-nonexist-fail") ) {
-        L<<Logger::Error<<"IPv4 Address " << localname << " does not exist on this server - skipping UDP bind" << endl;
+        g_log<<Logger::Error<<"IPv4 Address " << localname << " does not exist on this server - skipping UDP bind" << endl;
         continue;
       } else {
-        L<<Logger::Error<<"Unable to bind UDP socket to '"+locala.toStringWithPort()+"': "<<binderror<<endl;
+        g_log<<Logger::Error<<"Unable to bind UDP socket to '"+locala.toStringWithPort()+"': "<<binderror<<endl;
         throw PDNSException("Unable to bind to UDP socket");
       }
     }
     d_sockets.push_back(s);
-    L<<Logger::Error<<"UDP server bound to "<<locala.toStringWithPort()<<endl;
+    g_log<<Logger::Error<<"UDP server bound to "<<locala.toStringWithPort()<<endl;
     struct pollfd pfd;
     pfd.fd = s;
     pfd.events = POLLIN;
@@ -207,10 +207,10 @@ void UDPNameserver::bindIPv6()
     s=socket(AF_INET6,SOCK_DGRAM,0);
     if(s<0) {
       if( errno == EAFNOSUPPORT ) {
-        L<<Logger::Error<<"IPv6 Address Family is not supported - skipping UDPv6 bind" << endl;
+        g_log<<Logger::Error<<"IPv6 Address Family is not supported - skipping UDPv6 bind" << endl;
         return;
       } else {
-        L<<Logger::Error<<"Unable to acquire a UDPv6 socket: "+string(strerror(errno)) << endl;
+        g_log<<Logger::Error<<"Unable to acquire a UDPv6 socket: "+string(strerror(errno)) << endl;
         throw PDNSException("Unable to acquire a UDPv6 socket: "+string(strerror(errno)));
       }
     }
@@ -230,7 +230,7 @@ void UDPNameserver::bindIPv6()
     }
 
     if (!setSocketTimestamps(s))
-      L<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
+      g_log<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
 
 #ifdef SO_REUSEPORT
     if( d_can_reuseport )
@@ -246,10 +246,10 @@ void UDPNameserver::bindIPv6()
     if(::bind(s, (sockaddr*)&locala, sizeof(locala))<0) {
       close(s);
       if( errno == EADDRNOTAVAIL && ! ::arg().mustDo("local-ipv6-nonexist-fail") ) {
-        L<<Logger::Error<<"IPv6 Address " << localname << " does not exist on this server - skipping UDP bind" << endl;
+        g_log<<Logger::Error<<"IPv6 Address " << localname << " does not exist on this server - skipping UDP bind" << endl;
         continue;
       } else {
-        L<<Logger::Error<<"Unable to bind to UDPv6 socket "<< localname <<": "<<strerror(errno)<<endl;
+        g_log<<Logger::Error<<"Unable to bind to UDPv6 socket "<< localname <<": "<<strerror(errno)<<endl;
         throw PDNSException("Unable to bind to UDPv6 socket");
       }
     }
@@ -259,7 +259,7 @@ void UDPNameserver::bindIPv6()
     pfd.events = POLLIN;
     pfd.revents = 0;
     d_rfds.push_back(pfd);
-    L<<Logger::Error<<"UDPv6 server bound to "<<locala.toStringWithPort()<<endl;
+    g_log<<Logger::Error<<"UDPv6 server bound to "<<locala.toStringWithPort()<<endl;
   }
 }
 
@@ -277,7 +277,7 @@ UDPNameserver::UDPNameserver( bool additional_socket )
     bindIPv6();
 
   if(::arg()["local-address"].empty() && ::arg()["local-ipv6"].empty()) 
-    L<<Logger::Critical<<"PDNS is deaf and mute! Not listening on any interfaces"<<endl;    
+    g_log<<Logger::Critical<<"PDNS is deaf and mute! Not listening on any interfaces"<<endl;    
 }
 
 void UDPNameserver::send(DNSPacket *p)
@@ -295,12 +295,12 @@ void UDPNameserver::send(DNSPacket *p)
   if(p->d_anyLocal) {
     addCMsgSrcAddr(&msgh, cbuf, p->d_anyLocal.get_ptr(), 0);
   }
-  DLOG(L<<Logger::Notice<<"Sending a packet to "<< p->getRemote() <<" ("<< buffer.length()<<" octets)"<<endl);
+  DLOG(g_log<<Logger::Notice<<"Sending a packet to "<< p->getRemote() <<" ("<< buffer.length()<<" octets)"<<endl);
   if(buffer.length() > p->getMaxReplyLen()) {
-    L<<Logger::Error<<"Weird, trying to send a message that needs truncation, "<< buffer.length()<<" > "<<p->getMaxReplyLen()<<endl;
+    g_log<<Logger::Error<<"Weird, trying to send a message that needs truncation, "<< buffer.length()<<" > "<<p->getMaxReplyLen()<<endl;
   }
   if(sendmsg(p->getSocket(), &msgh, 0) < 0)
-    L<<Logger::Error<<"Error sending reply with sendmsg (socket="<<p->getSocket()<<", dest="<<p->d_remote.toStringWithPort()<<"): "<<strerror(errno)<<endl;
+    g_log<<Logger::Error<<"Error sending reply with sendmsg (socket="<<p->getSocket()<<", dest="<<p->d_remote.toStringWithPort()<<"): "<<strerror(errno)<<endl;
 }
 
 DNSPacket *UDPNameserver::receive(DNSPacket *prefilled, std::string& buffer)
@@ -339,7 +339,7 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled, std::string& buffer)
       sock=pfd.fd;        
       if((len=recvmsg(sock, &msgh, 0)) < 0 ) {
         if(errno != EAGAIN)
-          L<<Logger::Error<<"recvfrom gave error, ignoring: "<<strerror(errno)<<endl;
+          g_log<<Logger::Error<<"recvfrom gave error, ignoring: "<<strerror(errno)<<endl;
         return 0;
       }
       break;
@@ -348,7 +348,7 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled, std::string& buffer)
   if(sock==-1)
     throw PDNSException("poll betrayed us! (should not happen)");
   
-  DLOG(L<<"Received a packet " << len <<" bytes long from "<< remote.toString()<<endl);
+  DLOG(g_log<<"Received a packet " << len <<" bytes long from "<< remote.toString()<<endl);
 
   BOOST_STATIC_ASSERT(offsetof(sockaddr_in, sin_port) == offsetof(sockaddr_in6, sin6_port));
 
index 1079b964f2c8b8d7b5259ec1888e766908fe0b41..8e75e822eb86e3ef4dfb732ab1b5865154b9e5aa 100644 (file)
@@ -25,7 +25,6 @@
 #include <bitset>
 #include "dnsparser.hh"
 #include "iputils.hh"
-#undef L
 #include <boost/program_options.hpp>
 
 #include <boost/format.hpp>
index 705a1fce1d719502d5bdcbc5993fafdf1345eb9d..e79f8de75966accec800dc6336413b08e6f8dc10 100644 (file)
@@ -25,7 +25,6 @@
 #include <bitset>
 #include "dnsparser.hh"
 #include "iputils.hh"
-#undef L
 #include <boost/program_options.hpp>
 
 #include <boost/format.hpp>
index 6f18b63d0e31d4ca9daa2df80a78fe0473ab7f69..ad59c9f249e3cc48a22f6b3c837f61aef134b309 100644 (file)
@@ -94,7 +94,7 @@ UeberBackend *PacketHandler::getBackend()
 PacketHandler::~PacketHandler()
 {
   --s_count;
-  DLOG(L<<Logger::Error<<"PacketHandler destructor called - "<<s_count<<" left"<<endl);
+  DLOG(g_log<<Logger::Error<<"PacketHandler destructor called - "<<s_count<<" left"<<endl);
 }
 
 /**
@@ -324,7 +324,7 @@ vector<DNSZoneRecord> PacketHandler::getBestDNAMESynth(DNSPacket *p, SOAData& sd
   DNSName prefix;
   DNSName subdomain(target);
   do {
-    DLOG(L<<"Attempting DNAME lookup for "<<subdomain<<", sd.qname="<<sd.qname<<endl);
+    DLOG(g_log<<"Attempting DNAME lookup for "<<subdomain<<", sd.qname="<<sd.qname<<endl);
 
     B.lookup(QType(QType::DNAME), subdomain, p, sd.domain_id);
     while(B.get(rr)) {
@@ -375,7 +375,7 @@ bool PacketHandler::getBestWildcard(DNSPacket *p, SOAData& sd, const DNSName &ta
 
     B.lookup(QType(QType::ANY), subdomain, p, sd.domain_id);
     if (B.get(rr)) {
-      DLOG(L<<"No wildcard match, ancestor exists"<<endl);
+      DLOG(g_log<<"No wildcard match, ancestor exists"<<endl);
       while (B.get(rr)) ;
       break;
     }
@@ -423,7 +423,7 @@ int PacketHandler::doAdditionalProcessingAndDropAA(DNSPacket *p, DNSPacket *r, c
         if(rr.dr.d_type != QType::A && rr.dr.d_type!=QType::AAAA)
           continue;
         if(rr.domain_id!=i->domain_id && ::arg()["out-of-zone-additional-processing"]=="no") {
-          DLOG(L<<Logger::Warning<<"Not including out-of-zone additional processing of "<<i->dr.d_name<<" ("<<rr.dr.d_name<<")"<<endl);
+          DLOG(g_log<<Logger::Warning<<"Not including out-of-zone additional processing of "<<i->dr.d_name<<" ("<<rr.dr.d_name<<")"<<endl);
           continue; // not adding out-of-zone additional data
         }
         
@@ -577,11 +577,11 @@ bool getNSEC3Hashes(bool narrow, DNSBackend* db, int id, const std::string& hash
 
 void PacketHandler::addNSEC3(DNSPacket *p, DNSPacket *r, const DNSName& target, const DNSName& wildcard, const DNSName& auth, const NSEC3PARAMRecordContent& ns3rc, bool narrow, int mode)
 {
-  DLOG(L<<"addNSEC3() mode="<<mode<<" auth="<<auth<<" target="<<target<<" wildcard="<<wildcard<<endl);
+  DLOG(g_log<<"addNSEC3() mode="<<mode<<" auth="<<auth<<" target="<<target<<" wildcard="<<wildcard<<endl);
 
   SOAData sd;
   if(!B.getSOAUncached(auth, sd)) {
-    DLOG(L<<"Could not get SOA for domain");
+    DLOG(g_log<<"Could not get SOA for domain");
     return;
   }
 
@@ -599,12 +599,12 @@ void PacketHandler::addNSEC3(DNSPacket *p, DNSPacket *r, const DNSName& target,
   if (mode != 3) {
     unhashed=(mode == 0 || mode == 1 || mode == 5) ? target : closest;
     hashed=hashQNameWithSalt(ns3rc, unhashed);
-    DLOG(L<<"1 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl);
+    DLOG(g_log<<"1 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl);
 
     getNSEC3Hashes(narrow, sd.db, sd.domain_id,  hashed, false, unhashed, before, after, mode);
 
     if (((mode == 0 && ns3rc.d_flags) ||  mode == 1) && (hashed != before)) {
-      DLOG(L<<"No matching NSEC3, do closest (provable) encloser"<<endl);
+      DLOG(g_log<<"No matching NSEC3, do closest (provable) encloser"<<endl);
 
       bool doBreak = false;
       DNSZoneRecord rr;
@@ -619,13 +619,13 @@ void PacketHandler::addNSEC3(DNSPacket *p, DNSPacket *r, const DNSName& target,
       doNextcloser = true;
       unhashed=closest;
       hashed=hashQNameWithSalt(ns3rc, unhashed);
-      DLOG(L<<"1 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl);
+      DLOG(g_log<<"1 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl);
 
       getNSEC3Hashes(narrow, sd.db, sd.domain_id,  hashed, false, unhashed, before, after);
     }
 
     if (!after.empty()) {
-      DLOG(L<<"Done calling for matching, hashed: '"<<toBase32Hex(hashed)<<"' before='"<<toBase32Hex(before)<<"', after='"<<toBase32Hex(after)<<"'"<<endl);
+      DLOG(g_log<<"Done calling for matching, hashed: '"<<toBase32Hex(hashed)<<"' before='"<<toBase32Hex(before)<<"', after='"<<toBase32Hex(after)<<"'"<<endl);
       emitNSEC3(r, sd, ns3rc, unhashed, before, after, mode);
     }
   }
@@ -639,10 +639,10 @@ void PacketHandler::addNSEC3(DNSPacket *p, DNSPacket *r, const DNSName& target,
     while( next.chopOff() && !(next==closest));
 
     hashed=hashQNameWithSalt(ns3rc, unhashed);
-    DLOG(L<<"2 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl);
+    DLOG(g_log<<"2 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl);
 
     getNSEC3Hashes(narrow, sd.db,sd.domain_id,  hashed, true, unhashed, before, after);
-    DLOG(L<<"Done calling for covering, hashed: '"<<toBase32Hex(hashed)<<"' before='"<<toBase32Hex(before)<<"', after='"<<toBase32Hex(after)<<"'"<<endl);
+    DLOG(g_log<<"Done calling for covering, hashed: '"<<toBase32Hex(hashed)<<"' before='"<<toBase32Hex(before)<<"', after='"<<toBase32Hex(after)<<"'"<<endl);
     emitNSEC3( r, sd, ns3rc, unhashed, before, after, mode);
   }
 
@@ -651,21 +651,21 @@ void PacketHandler::addNSEC3(DNSPacket *p, DNSPacket *r, const DNSName& target,
     unhashed=g_wildcarddnsname+closest;
 
     hashed=hashQNameWithSalt(ns3rc, unhashed);
-    DLOG(L<<"3 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl);
+    DLOG(g_log<<"3 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl);
 
     getNSEC3Hashes(narrow, sd.db, sd.domain_id,  hashed, (mode != 2), unhashed, before, after);
-    DLOG(L<<"Done calling for '*', hashed: '"<<toBase32Hex(hashed)<<"' before='"<<toBase32Hex(before)<<"', after='"<<toBase32Hex(after)<<"'"<<endl);
+    DLOG(g_log<<"Done calling for '*', hashed: '"<<toBase32Hex(hashed)<<"' before='"<<toBase32Hex(before)<<"', after='"<<toBase32Hex(after)<<"'"<<endl);
     emitNSEC3( r, sd, ns3rc, unhashed, before, after, mode);
   }
 }
 
 void PacketHandler::addNSEC(DNSPacket *p, DNSPacket *r, const DNSName& target, const DNSName& wildcard, const DNSName& auth, int mode)
 {
-  DLOG(L<<"addNSEC() mode="<<mode<<" auth="<<auth<<" target="<<target<<" wildcard="<<wildcard<<endl);
+  DLOG(g_log<<"addNSEC() mode="<<mode<<" auth="<<auth<<" target="<<target<<" wildcard="<<wildcard<<endl);
 
   SOAData sd;
   if(!B.getSOAUncached(auth, sd)) {
-    DLOG(L<<"Could not get SOA for domain"<<endl);
+    DLOG(g_log<<"Could not get SOA for domain"<<endl);
     return;
   }
 
@@ -744,7 +744,7 @@ int PacketHandler::trySuperMasterSynchronous(DNSPacket *p, const DNSName& tsigke
     resolver.resolve(remote, p->qdomain, QType::NS, &nsset);
   }
   catch(ResolverException &re) {
-    L<<Logger::Error<<"Error resolving SOA or NS for "<<p->qdomain<<" at: "<< remote <<": "<<re.reason<<endl;
+    g_log<<Logger::Error<<"Error resolving SOA or NS for "<<p->qdomain<<" at: "<< remote <<": "<<re.reason<<endl;
     return RCode::ServFail;
   }
 
@@ -756,7 +756,7 @@ int PacketHandler::trySuperMasterSynchronous(DNSPacket *p, const DNSName& tsigke
   }
 
   if(!haveNS) {
-    L<<Logger::Error<<"While checking for supermaster, did not find NS for "<<p->qdomain<<" at: "<< remote <<endl;
+    g_log<<Logger::Error<<"While checking for supermaster, did not find NS for "<<p->qdomain<<" at: "<< remote <<endl;
     return RCode::ServFail;
   }
 
@@ -764,15 +764,15 @@ int PacketHandler::trySuperMasterSynchronous(DNSPacket *p, const DNSName& tsigke
   DNSBackend *db;
 
   if (!::arg().mustDo("allow-unsigned-supermaster") && tsigkeyname.empty()) {
-    L<<Logger::Error<<"Received unsigned NOTIFY for "<<p->qdomain<<" from potential supermaster "<<remote<<". Refusing."<<endl;
+    g_log<<Logger::Error<<"Received unsigned NOTIFY for "<<p->qdomain<<" from potential supermaster "<<remote<<". Refusing."<<endl;
     return RCode::Refused;
   }
 
   if(!B.superMasterBackend(remote, p->qdomain, nsset, &nameserver, &account, &db)) {
-    L<<Logger::Error<<"Unable to find backend willing to host "<<p->qdomain<<" for potential supermaster "<<remote<<". Remote nameservers: "<<endl;
+    g_log<<Logger::Error<<"Unable to find backend willing to host "<<p->qdomain<<" for potential supermaster "<<remote<<". Remote nameservers: "<<endl;
     for(const auto& rr: nsset) {
       if(rr.qtype==QType::NS)
-        L<<Logger::Error<<rr.content<<endl;
+        g_log<<Logger::Error<<rr.content<<endl;
     }
     return RCode::Refused;
   }
@@ -785,10 +785,10 @@ int PacketHandler::trySuperMasterSynchronous(DNSPacket *p, const DNSName& tsigke
     }
   }
   catch(PDNSException& ae) {
-    L<<Logger::Error<<"Database error trying to create "<<p->qdomain<<" for potential supermaster "<<remote<<": "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"Database error trying to create "<<p->qdomain<<" for potential supermaster "<<remote<<": "<<ae.reason<<endl;
     return RCode::ServFail;
   }
-  L<<Logger::Warning<<"Created new slave zone '"<<p->qdomain<<"' from supermaster "<<remote<<endl;
+  g_log<<Logger::Warning<<"Created new slave zone '"<<p->qdomain<<"' from supermaster "<<remote<<endl;
   return RCode::NoError;
 }
 
@@ -804,15 +804,15 @@ int PacketHandler::processNotify(DNSPacket *p)
   vector<string> meta;
 
   if(!::arg().mustDo("slave") && s_forwardNotify.empty()) {
-    L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" but slave support is disabled in the configuration"<<endl;
+    g_log<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" but slave support is disabled in the configuration"<<endl;
     return RCode::NotImp;
   }
 
   if(!s_allowNotifyFrom.match((ComboAddress *) &p->d_remote ) || p->d_havetsig) {
     if (p->d_havetsig && p->getTSIGKeyname().empty() == false) {
-        L<<Logger::Notice<<"Received secure NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<", allowed by TSIG key '"<<p->getTSIGKeyname()<<"'"<<endl;
+        g_log<<Logger::Notice<<"Received secure NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<", allowed by TSIG key '"<<p->getTSIGKeyname()<<"'"<<endl;
     } else {
-      L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" but remote is not permitted by TSIG or allow-notify-from"<<endl;
+      g_log<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" but remote is not permitted by TSIG or allow-notify-from"<<endl;
       return RCode::Refused;
     }
   }
@@ -821,7 +821,7 @@ int PacketHandler::processNotify(DNSPacket *p)
   DomainInfo di;
   di.serial = 0;
   if(!B.getDomainInfo(p->qdomain, di) || !(db=di.backend)) {
-    L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" for which we are not authoritative"<<endl;
+    g_log<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" for which we are not authoritative"<<endl;
     return trySuperMaster(p, p->getTSIGKeyname());
   }
 
@@ -829,30 +829,30 @@ int PacketHandler::processNotify(DNSPacket *p)
   if (B.getDomainMetadata(p->qdomain,"AXFR-MASTER-TSIG",meta) && meta.size() > 0) {
     if (!p->d_havetsig) {
       if (::arg().mustDo("allow-unsigned-notify")) {
-        L<<Logger::Warning<<"Received unsigned NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<": permitted because allow-unsigned-notify";
+        g_log<<Logger::Warning<<"Received unsigned NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<": permitted because allow-unsigned-notify";
       } else {
-        L<<Logger::Warning<<"Received unsigned NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<": refused"<<endl;
+        g_log<<Logger::Warning<<"Received unsigned NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<": refused"<<endl;
         return RCode::Refused;
       }
     } else if (meta[0] != p->getTSIGKeyname().toStringNoDot()) {
-      L<<Logger::Error<<"Received secure NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<": expected TSIG key '"<<meta[0]<<", got '"<<p->getTSIGKeyname()<<"'"<<endl;
+      g_log<<Logger::Error<<"Received secure NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<": expected TSIG key '"<<meta[0]<<", got '"<<p->getTSIGKeyname()<<"'"<<endl;
       return RCode::Refused;
     }
   }
 
   if(::arg().contains("trusted-notification-proxy", p->getRemote().toString())) {
-    L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from trusted-notification-proxy "<< p->getRemote()<<endl;
+    g_log<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from trusted-notification-proxy "<< p->getRemote()<<endl;
     if(di.masters.empty()) {
-      L<<Logger::Error<<"However, "<<p->qdomain<<" does not have any masters defined"<<endl;
+      g_log<<Logger::Error<<"However, "<<p->qdomain<<" does not have any masters defined"<<endl;
       return RCode::Refused;
     }
   }
   else if(::arg().mustDo("master") && di.kind == DomainInfo::Master) {
-    L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" but we are master, rejecting"<<endl;
+    g_log<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" but we are master, rejecting"<<endl;
     return RCode::Refused;
   }
   else if(!db->isMaster(p->qdomain, p->getRemote().toString())) {
-    L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" which is not a master"<<endl;
+    g_log<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" which is not a master"<<endl;
     return RCode::Refused;
   }
     
@@ -862,7 +862,7 @@ int PacketHandler::processNotify(DNSPacket *p)
   if(!s_forwardNotify.empty()) {
     set<string> forwardNotify(s_forwardNotify);
     for(set<string>::const_iterator j=forwardNotify.begin();j!=forwardNotify.end();++j) {
-      L<<Logger::Warning<<"Relaying notification of domain "<<p->qdomain<<" from "<<p->getRemote()<<" to "<<*j<<endl;
+      g_log<<Logger::Warning<<"Relaying notification of domain "<<p->qdomain<<" from "<<p->getRemote()<<" to "<<*j<<endl;
       Communicator.notify(p->qdomain,*j);
     }
   }
@@ -1008,7 +1008,7 @@ bool PacketHandler::tryDNAME(DNSPacket *p, DNSPacket*r, SOAData& sd, DNSName &ta
 {
   if(!d_doDNAME)
     return false;
-  DLOG(L<<Logger::Warning<<"Let's try DNAME.."<<endl);
+  DLOG(g_log<<Logger::Warning<<"Let's try DNAME.."<<endl);
   vector<DNSZoneRecord> rrset = getBestDNAMESynth(p, sd, target);
   if(!rrset.empty()) {
     for(auto& rr: rrset) {
@@ -1029,7 +1029,7 @@ bool PacketHandler::tryWildcard(DNSPacket *p, DNSPacket*r, SOAData& sd, DNSName
     return false;
 
   if(rrset.empty()) {
-    DLOG(L<<"Wildcard matched something, but not of the correct type"<<endl);
+    DLOG(g_log<<"Wildcard matched something, but not of the correct type"<<endl);
     nodata=true;
   }
   else {
@@ -1070,7 +1070,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
   
   if(p->d.qr) { // QR bit from dns packet (thanks RA from N)
     if(d_logDNSDetails)
-      L<<Logger::Error<<"Received an answer (non-query) packet from "<<p->getRemote()<<", dropping"<<endl;
+      g_log<<Logger::Error<<"Received an answer (non-query) packet from "<<p->getRemote()<<", dropping"<<endl;
     S.inc("corrupt-packets");
     S.ringAccount("remotes-corrupt", p->d_remote);
     return 0;
@@ -1078,7 +1078,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
 
   if(p->d.tc) { // truncated query. MOADNSParser would silently parse this packet in an incomplete way.
     if(d_logDNSDetails)
-      L<<Logger::Error<<"Received truncated query packet from "<<p->getRemote()<<", dropping"<<endl;
+      g_log<<Logger::Error<<"Received truncated query packet from "<<p->getRemote()<<", dropping"<<endl;
     S.inc("corrupt-packets");
     S.ringAccount("remotes-corrupt", p->d_remote);
     return 0;
@@ -1098,7 +1098,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
     if(!p->checkForCorrectTSIG(&B, &keyname, &secret, &trc)) {
       r=p->replyPacket();  // generate an empty reply packet
       if(d_logDNSDetails)
-        L<<Logger::Error<<"Received a TSIG signed message with a non-validating key"<<endl;
+        g_log<<Logger::Error<<"Received a TSIG signed message with a non-validating key"<<endl;
       // RFC3007 describes that a non-secure message should be sending Refused for DNS Updates
       if (p->d.opcode == Opcode::Update)
         r->setRcode(RCode::Refused);
@@ -1110,7 +1110,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
       if (p->d_tsig_algo == TSIG_GSS) {
         GssContext gssctx(keyname);
         if (!gssctx.getPeerPrincipal(p->d_peer_principal)) {
-          L<<Logger::Warning<<"Failed to extract peer principal from GSS context with keyname '"<<keyname<<"'"<<endl;
+          g_log<<Logger::Warning<<"Failed to extract peer principal from GSS context with keyname '"<<keyname<<"'"<<endl;
         }
       }
     }
@@ -1131,7 +1131,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
 
     if(!validDNSName(p->qdomain)) {
       if(d_logDNSDetails)
-        L<<Logger::Error<<"Received a malformed qdomain from "<<p->getRemote()<<", '"<<p->qdomain<<"': sending servfail"<<endl;
+        g_log<<Logger::Error<<"Received a malformed qdomain from "<<p->getRemote()<<", '"<<p->qdomain<<"': sending servfail"<<endl;
       S.inc("corrupt-packets");
       S.ringAccount("remotes-corrupt", p->d_remote);
       S.inc("servfail-packets");
@@ -1162,13 +1162,13 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
         return 0;
       }
       
-      L<<Logger::Error<<"Received an unknown opcode "<<p->d.opcode<<" from "<<p->getRemote()<<" for "<<p->qdomain<<endl;
+      g_log<<Logger::Error<<"Received an unknown opcode "<<p->d.opcode<<" from "<<p->getRemote()<<" for "<<p->qdomain<<endl;
 
       r->setRcode(RCode::NotImp); 
       return r; 
     }
 
-    // L<<Logger::Warning<<"Query for '"<<p->qdomain<<"' "<<p->qtype.getName()<<" from "<<p->getRemote()<< " (tcp="<<p->d_tcp<<")"<<endl;
+    // g_log<<Logger::Warning<<"Query for '"<<p->qdomain<<"' "<<p->qtype.getName()<<" from "<<p->getRemote()<< " (tcp="<<p->d_tcp<<")"<<endl;
     
     if(p->qtype.getCode()==QType::IXFR) {
       r->setRcode(RCode::Refused);
@@ -1205,7 +1205,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
 
   retargeted:;
     if(retargetcount > 10) {    // XXX FIXME, retargetcount++?
-      L<<Logger::Warning<<"Abort CNAME chain resolution after "<<--retargetcount<<" redirects, sending out servfail. Initial query: '"<<p->qdomain<<"'"<<endl;
+      g_log<<Logger::Warning<<"Abort CNAME chain resolution after "<<--retargetcount<<" redirects, sending out servfail. Initial query: '"<<p->qdomain<<"'"<<endl;
       delete r;
       r=p->replyPacket();
       r->setRcode(RCode::ServFail);
@@ -1213,14 +1213,14 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
     }
     
     if(!B.getAuth(target, p->qtype, &sd)) {
-      DLOG(L<<Logger::Error<<"We have no authority over zone '"<<target<<"'"<<endl);
+      DLOG(g_log<<Logger::Error<<"We have no authority over zone '"<<target<<"'"<<endl);
       if(!retargetcount) {
         r->setA(false); // drop AA if we never had a SOA in the first place
         r->setRcode(RCode::Refused); // send REFUSED - but only on empty 'no idea'
       }
       goto sendit;
     }
-    DLOG(L<<Logger::Error<<"We have authority, zone='"<<sd.qname<<"', id="<<sd.domain_id<<endl);
+    DLOG(g_log<<Logger::Error<<"We have authority, zone='"<<sd.qname<<"', id="<<sd.domain_id<<endl);
     authSet.insert(sd.qname); 
 
     if(!retargetcount) r->qdomainzone=sd.qname;
@@ -1270,16 +1270,16 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
 
     // this TRUMPS a cname!
     if(p->qtype.getCode() == QType::RRSIG) {
-      L<<Logger::Info<<"Direct RRSIG query for "<<target<<" from "<<p->getRemote()<<endl;
+      g_log<<Logger::Info<<"Direct RRSIG query for "<<target<<" from "<<p->getRemote()<<endl;
       r->setRcode(RCode::Refused);
       goto sendit;
     }
 
-    DLOG(L<<"Checking for referrals first, unless this is a DS query"<<endl);
+    DLOG(g_log<<"Checking for referrals first, unless this is a DS query"<<endl);
     if(p->qtype.getCode() != QType::DS && tryReferral(p, r, sd, target, retargetcount))
       goto sendit;
 
-    DLOG(L<<"Got no referrals, trying ANY"<<endl);
+    DLOG(g_log<<"Got no referrals, trying ANY"<<endl);
 
     // see what we get..
     B.lookup(QType(QType::ANY), target, p, sd.domain_id);
@@ -1306,7 +1306,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
 
       if(DP && rr.dr.d_type == QType::ALIAS && (p->qtype.getCode() == QType::A || p->qtype.getCode() == QType::AAAA || p->qtype.getCode() == QType::ANY)) {
         if (!d_doExpandALIAS) {
-          L<<Logger::Info<<"ALIAS record found for "<<target<<", but ALIAS expansion is disabled."<<endl;
+          g_log<<Logger::Info<<"ALIAS record found for "<<target<<", but ALIAS expansion is disabled."<<endl;
           continue;
         }
         haveAlias=getRR<ALIASRecordContent>(rr.dr)->d_content;
@@ -1332,33 +1332,33 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
     }
 
 
-    DLOG(L<<"After first ANY query for '"<<target<<"', id="<<sd.domain_id<<": weDone="<<weDone<<", weHaveUnauth="<<weHaveUnauth<<", weRedirected="<<weRedirected<<", haveAlias='"<<haveAlias<<"'"<<endl);
+    DLOG(g_log<<"After first ANY query for '"<<target<<"', id="<<sd.domain_id<<": weDone="<<weDone<<", weHaveUnauth="<<weHaveUnauth<<", weRedirected="<<weRedirected<<", haveAlias='"<<haveAlias<<"'"<<endl);
     if(p->qtype.getCode() == QType::DS && weHaveUnauth &&  !weDone && !weRedirected && d_dk.isSecuredZone(sd.qname)) {
-      DLOG(L<<"Q for DS of a name for which we do have NS, but for which we don't have on a zone with DNSSEC need to provide an AUTH answer that proves we don't"<<endl);
+      DLOG(g_log<<"Q for DS of a name for which we do have NS, but for which we don't have on a zone with DNSSEC need to provide an AUTH answer that proves we don't"<<endl);
       makeNOError(p, r, target, DNSName(), sd, 1);
       goto sendit;
     }
 
     if(!haveAlias.empty() && (!weDone || p->qtype.getCode() == QType::ANY)) {
-      DLOG(L<<Logger::Warning<<"Found nothing that matched for '"<<target<<"', but did get alias to '"<<haveAlias<<"', referring"<<endl);
+      DLOG(g_log<<Logger::Warning<<"Found nothing that matched for '"<<target<<"', but did get alias to '"<<haveAlias<<"', referring"<<endl);
       DP->completePacket(r, haveAlias, target);
       return 0;
     }
 
     if(rrset.empty()) {
-      DLOG(L<<"checking qtype.getCode() ["<<(p->qtype.getCode())<<"] against QType::DS ["<<(QType::DS)<<"]"<<endl);
+      DLOG(g_log<<"checking qtype.getCode() ["<<(p->qtype.getCode())<<"] against QType::DS ["<<(QType::DS)<<"]"<<endl);
       if(p->qtype.getCode() == QType::DS)
       {
-        DLOG(L<<"DS query found no direct result, trying referral now"<<endl);
+        DLOG(g_log<<"DS query found no direct result, trying referral now"<<endl);
         if(tryReferral(p, r, sd, target, retargetcount))
         {
-          DLOG(L<<"got referral for DS query"<<endl);
+          DLOG(g_log<<"got referral for DS query"<<endl);
           goto sendit;
         }
       }
 
 
-      DLOG(L<<Logger::Warning<<"Found nothing in the by-name ANY, but let's try wildcards.."<<endl);
+      DLOG(g_log<<Logger::Warning<<"Found nothing in the by-name ANY, but let's try wildcards.."<<endl);
       bool wereRetargeted(false), nodata(false);
       DNSName wildcard;
       if(tryWildcard(p, r, sd, target, wildcard, wereRetargeted, nodata)) {
@@ -1414,18 +1414,18 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
       goto sendit;
     }
     else if(weHaveUnauth) {
-      DLOG(L<<"Have unauth data, so need to hunt for best NS records"<<endl);
+      DLOG(g_log<<"Have unauth data, so need to hunt for best NS records"<<endl);
       if(tryReferral(p, r, sd, target, retargetcount))
         goto sendit;
       // check whether this could be fixed easily
       // if (*(rr.dr.d_name.rbegin()) == '.') {
-      //      L<<Logger::Error<<"Should not get here ("<<p->qdomain<<"|"<<p->qtype.getCode()<<"): you have a trailing dot, this could be the problem (or run pdnsutil rectify-zone " <<sd.qname<<")"<<endl;
+      //      g_log<<Logger::Error<<"Should not get here ("<<p->qdomain<<"|"<<p->qtype.getCode()<<"): you have a trailing dot, this could be the problem (or run pdnsutil rectify-zone " <<sd.qname<<")"<<endl;
       // } else {
-           L<<Logger::Error<<"Should not get here ("<<p->qdomain<<"|"<<p->qtype.getCode()<<"): please run pdnsutil rectify-zone "<<sd.qname<<endl;
+           g_log<<Logger::Error<<"Should not get here ("<<p->qdomain<<"|"<<p->qtype.getCode()<<"): please run pdnsutil rectify-zone "<<sd.qname<<endl;
       // }
     }
     else {
-      DLOG(L<<"Have some data, but not the right data"<<endl);
+      DLOG(g_log<<"Have some data, but not the right data"<<endl);
       makeNOError(p, r, target, DNSName(), sd, 0);
     }
     
@@ -1449,7 +1449,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
       PC.insert(p, r, r->getMinTTL()); // in the packet cache
   }
   catch(DBException &e) {
-    L<<Logger::Error<<"Backend reported condition which prevented lookup ("+e.reason+") sending out servfail"<<endl;
+    g_log<<Logger::Error<<"Backend reported condition which prevented lookup ("+e.reason+") sending out servfail"<<endl;
     delete r;
     r=p->replyPacket(); // generate an empty reply packet
     r->setRcode(RCode::ServFail);
@@ -1457,11 +1457,11 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
     S.ringAccount("servfail-queries",p->qdomain.toLogString());
   }
   catch(PDNSException &e) {
-    L<<Logger::Error<<"Backend reported permanent error which prevented lookup ("+e.reason+"), aborting"<<endl;
+    g_log<<Logger::Error<<"Backend reported permanent error which prevented lookup ("+e.reason+"), aborting"<<endl;
     throw; // we WANT to die at this point
   }
   catch(std::exception &e) {
-    L<<Logger::Error<<"Exception building answer packet for "<<p->qdomain<<"/"<<p->qtype.getName()<<" ("<<e.what()<<") sending out servfail"<<endl;
+    g_log<<Logger::Error<<"Exception building answer packet for "<<p->qdomain<<"/"<<p->qtype.getName()<<" ("<<e.what()<<") sending out servfail"<<endl;
     delete r;
     r=p->replyPacket(); // generate an empty reply packet
     r->setRcode(RCode::ServFail);
index 4957393c939ded90c94258785d386a9d2e3d0723..79d3d85d1d971e5c7d4974cb35556e8763024b55 100644 (file)
@@ -339,7 +339,7 @@ static void handleGenUDPQueryResponse(int fd, FDMultiplexer::funcparam_t& var)
 
   ssize_t ret=recvfrom(fd, resp, sizeof(resp), 0, (sockaddr *)&fromaddr, &addrlen);
   if (fromaddr != pident.remote) {
-    L<<Logger::Notice<<"Response received from the wrong remote host ("<<fromaddr.toStringWithPort()<<" instead of "<<pident.remote.toStringWithPort()<<"), discarding"<<endl;
+    g_log<<Logger::Notice<<"Response received from the wrong remote host ("<<fromaddr.toStringWithPort()<<" instead of "<<pident.remote.toStringWithPort()<<"), discarding"<<endl;
 
   }
 
@@ -414,12 +414,12 @@ static void setSocketBuffer(int fd, int optname, uint32_t size)
   socklen_t len=sizeof(psize);
 
   if(!getsockopt(fd, SOL_SOCKET, optname, (char*)&psize, &len) && psize > size) {
-    L<<Logger::Error<<"Not decreasing socket buffer size from "<<psize<<" to "<<size<<endl;
+    g_log<<Logger::Error<<"Not decreasing socket buffer size from "<<psize<<" to "<<size<<endl;
     return;
   }
 
   if (setsockopt(fd, SOL_SOCKET, optname, (char*)&size, sizeof(size)) < 0 )
-    L<<Logger::Error<<"Unable to raise socket buffer size to "<<size<<": "<<strerror(errno)<<endl;
+    g_log<<Logger::Error<<"Unable to raise socket buffer size to "<<size<<": "<<strerror(errno)<<endl;
 }
 
 
@@ -462,7 +462,7 @@ public:
         closesocket(*fd);
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing UDP socket after connect() failed: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing UDP socket after connect() failed: "<<e.reason<<endl;
       }
 
       if(err==ENETUNREACH) // Seth "My Interfaces Are Like A Yo Yo" Arnold special
@@ -500,7 +500,7 @@ public:
       closesocket(*i);
     }
     catch(const PDNSException& e) {
-      L<<Logger::Error<<"Error closing returned UDP socket: "<<e.reason<<endl;
+      g_log<<Logger::Error<<"Error closing returned UDP socket: "<<e.reason<<endl;
     }
 
     d_socks.erase(i++);
@@ -620,7 +620,7 @@ int arecvfrom(char *data, size_t len, int flags, const ComboAddress& fromaddr, s
     *d_len=packet.size();
     memcpy(data,packet.c_str(),min(len,*d_len));
     if(*nearMissLimit && pident.nearMisses > *nearMissLimit) {
-      L<<Logger::Error<<"Too many ("<<pident.nearMisses<<" > "<<*nearMissLimit<<") bogus answers for '"<<domain<<"' from "<<fromaddr.toString()<<", assuming spoof attempt."<<endl;
+      g_log<<Logger::Error<<"Too many ("<<pident.nearMisses<<" > "<<*nearMissLimit<<") bogus answers for '"<<domain<<"' from "<<fromaddr.toString()<<", assuming spoof attempt."<<endl;
       g_stats.spoofCount++;
       return -1;
     }
@@ -640,7 +640,7 @@ static void writePid(void)
   if(of)
     of<< Utility::getpid() <<endl;
   else
-    L<<Logger::Error<<"Writing pid for "<<Utility::getpid()<<" to "<<s_pidfname<<" failed: "<<strerror(errno)<<endl;
+    g_log<<Logger::Error<<"Writing pid for "<<Utility::getpid()<<" to "<<s_pidfname<<" failed: "<<strerror(errno)<<endl;
 }
 
 TCPConnection::TCPConnection(int fd, const ComboAddress& addr) : d_remote(addr), d_fd(fd)
@@ -653,10 +653,10 @@ TCPConnection::~TCPConnection()
 {
   try {
     if(closesocket(d_fd) < 0)
-      L<<Logger::Error<<"Error closing socket for TCPConnection"<<endl;
+      g_log<<Logger::Error<<"Error closing socket for TCPConnection"<<endl;
   }
   catch(const PDNSException& e) {
-    L<<Logger::Error<<"Error closing TCPConnection socket: "<<e.reason<<endl;
+    g_log<<Logger::Error<<"Error closing TCPConnection socket: "<<e.reason<<endl;
   }
 
   if(t_tcpClientCounts->count(d_remote) && !(*t_tcpClientCounts)[d_remote]--)
@@ -903,12 +903,12 @@ static void startDoResolve(void *p)
 
 
     if(!g_quiet || tracedQuery) {
-      L<<Logger::Warning<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] " << (dc->d_tcp ? "TCP " : "") << "question for '"<<dc->d_mdp.d_qname<<"|"
+      g_log<<Logger::Warning<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] " << (dc->d_tcp ? "TCP " : "") << "question for '"<<dc->d_mdp.d_qname<<"|"
        <<DNSRecordContent::NumberToType(dc->d_mdp.d_qtype)<<"' from "<<dc->getRemote();
       if(!dc->d_ednssubnet.source.empty()) {
-        L<<" (ecs "<<dc->d_ednssubnet.source.toString()<<")";
+        g_log<<" (ecs "<<dc->d_ednssubnet.source.toString()<<")";
       }
-      L<<endl;
+      g_log<<endl;
     }
 
     sr.setId(MT->getTid());
@@ -971,7 +971,7 @@ static void startDoResolve(void *p)
       }
       catch(ImmediateServFailException &e) {
         if(g_logCommonErrors)
-          L<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during resolve of '"<<dc->d_mdp.d_qname<<"' because: "<<e.reason<<endl;
+          g_log<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during resolve of '"<<dc->d_mdp.d_qname<<"' because: "<<e.reason<<endl;
         res = RCode::ServFail;
       }
 
@@ -1093,7 +1093,7 @@ static void startDoResolve(void *p)
         boost::split(lines, trace, boost::is_any_of("\n"));
         for(const string& line : lines) {
           if(!line.empty())
-            L<<Logger::Warning<< line << endl;
+            g_log<<Logger::Warning<< line << endl;
         }
       }
     }
@@ -1110,14 +1110,14 @@ static void startDoResolve(void *p)
       if(!shouldNotValidate && sr.isDNSSECValidationRequested()) {
         try {
           if(sr.doLog()) {
-            L<<Logger::Warning<<"Starting validation of answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->getRemote()<<endl;
+            g_log<<Logger::Warning<<"Starting validation of answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->getRemote()<<endl;
           }
 
           auto state = sr.getValidationState();
 
           if(state == Secure) {
             if(sr.doLog()) {
-              L<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->getRemote()<<" validates correctly"<<endl;
+              g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->getRemote()<<" validates correctly"<<endl;
             }
             
             // Is the query source interested in the value of the ad-bit?
@@ -1126,34 +1126,34 @@ static void startDoResolve(void *p)
           }
           else if(state == Insecure) {
             if(sr.doLog()) {
-              L<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->getRemote()<<" validates as Insecure"<<endl;
+              g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->getRemote()<<" validates as Insecure"<<endl;
             }
             
             pw.getHeader()->ad=0;
           }
           else if(state == Bogus) {
             if(g_dnssecLogBogus || sr.doLog() || g_dnssecmode == DNSSECMode::ValidateForLog) {
-              L<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->getRemote()<<" validates as Bogus"<<endl;
+              g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->getRemote()<<" validates as Bogus"<<endl;
             }
             
             // Does the query or validation mode sending out a SERVFAIL on validation errors?
             if(!pw.getHeader()->cd && (g_dnssecmode == DNSSECMode::ValidateAll || dc->d_mdp.d_header.ad || DNSSECOK)) {
               if(sr.doLog()) {
-                L<<Logger::Warning<<"Sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" because recursor or query demands it for Bogus results"<<endl;
+                g_log<<Logger::Warning<<"Sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" because recursor or query demands it for Bogus results"<<endl;
               }
               
               pw.getHeader()->rcode=RCode::ServFail;
               goto sendit;
             } else {
               if(sr.doLog()) {
-                L<<Logger::Warning<<"Not sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" Bogus validation since neither config nor query demands this"<<endl;
+                g_log<<Logger::Warning<<"Not sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" Bogus validation since neither config nor query demands this"<<endl;
               }
             }
           }
         }
         catch(ImmediateServFailException &e) {
           if(g_logCommonErrors)
-            L<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during validation of '"<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<"' because: "<<e.reason<<endl;
+            g_log<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during validation of '"<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<"' because: "<<e.reason<<endl;
           pw.getHeader()->rcode=RCode::ServFail;
           goto sendit;
         }
@@ -1240,7 +1240,7 @@ static void startDoResolve(void *p)
        addCMsgSrcAddr(&msgh, cbuf, &dc->d_local, 0);
       }
       if(sendmsg(dc->d_socket, &msgh, 0) < 0 && g_logCommonErrors) 
-        L<<Logger::Warning<<"Sending UDP reply to client "<<dc->getRemote()<<" failed with: "<<strerror(errno)<<endl;
+        g_log<<Logger::Warning<<"Sending UDP reply to client "<<dc->getRemote()<<" failed with: "<<strerror(errno)<<endl;
 
       if(!SyncRes::s_nopacketcache && !variableAnswer && !sr.wasVariable() ) {
         t_packetCache->insertResponsePacket(dc->d_tag, dc->d_qhash, dc->d_mdp.d_qname, dc->d_mdp.d_qtype, dc->d_mdp.d_qclass,
@@ -1266,11 +1266,11 @@ static void startDoResolve(void *p)
       bool hadError=true;
 
       if(wret == 0)
-        L<<Logger::Error<<"EOF writing TCP answer to "<<dc->getRemote()<<endl;
+        g_log<<Logger::Error<<"EOF writing TCP answer to "<<dc->getRemote()<<endl;
       else if(wret < 0 )
-        L<<Logger::Error<<"Error writing TCP answer to "<<dc->getRemote()<<": "<< strerror(errno) <<endl;
+        g_log<<Logger::Error<<"Error writing TCP answer to "<<dc->getRemote()<<": "<< strerror(errno) <<endl;
       else if((unsigned int)wret != 2 + packet.size())
-        L<<Logger::Error<<"Oops, partial answer sent to "<<dc->getRemote()<<" for "<<dc->d_mdp.d_qname<<" (size="<< (2 + packet.size()) <<", sent "<<wret<<")"<<endl;
+        g_log<<Logger::Error<<"Oops, partial answer sent to "<<dc->getRemote()<<" for "<<dc->d_mdp.d_qname<<" (size="<< (2 + packet.size()) <<", sent "<<wret<<")"<<endl;
       else
         hadError=false;
 
@@ -1295,16 +1295,16 @@ static void startDoResolve(void *p)
     }
     float spent=makeFloat(sr.getNow()-dc->d_now);
     if(!g_quiet) {
-      L<<Logger::Error<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] answer to "<<(dc->d_mdp.d_header.rd?"":"non-rd ")<<"question '"<<dc->d_mdp.d_qname<<"|"<<DNSRecordContent::NumberToType(dc->d_mdp.d_qtype);
-      L<<"': "<<ntohs(pw.getHeader()->ancount)<<" answers, "<<ntohs(pw.getHeader()->arcount)<<" additional, took "<<sr.d_outqueries<<" packets, "<<
+      g_log<<Logger::Error<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] answer to "<<(dc->d_mdp.d_header.rd?"":"non-rd ")<<"question '"<<dc->d_mdp.d_qname<<"|"<<DNSRecordContent::NumberToType(dc->d_mdp.d_qtype);
+      g_log<<"': "<<ntohs(pw.getHeader()->ancount)<<" answers, "<<ntohs(pw.getHeader()->arcount)<<" additional, took "<<sr.d_outqueries<<" packets, "<<
        sr.d_totUsec/1000.0<<" netw ms, "<< spent*1000.0<<" tot ms, "<<
        sr.d_throttledqueries<<" throttled, "<<sr.d_timeouts<<" timeouts, "<<sr.d_tcpoutqueries<<" tcp connections, rcode="<< res;
 
       if(!shouldNotValidate && sr.isDNSSECValidationRequested()) {
-       L<< ", dnssec="<<vStates[sr.getValidationState()];
+       g_log<< ", dnssec="<<vStates[sr.getValidationState()];
       }
        
-      L<<endl;
+      g_log<<endl;
 
     }
 
@@ -1357,28 +1357,28 @@ static void startDoResolve(void *p)
     dc=0;
   }
   catch(PDNSException &ae) {
-    L<<Logger::Error<<"startDoResolve problem "<<makeLoginfo(dc)<<": "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"startDoResolve problem "<<makeLoginfo(dc)<<": "<<ae.reason<<endl;
     delete dc;
   }
   catch(MOADNSException& e) {
-    L<<Logger::Error<<"DNS parser error "<<makeLoginfo(dc) <<": "<<dc->d_mdp.d_qname<<", "<<e.what()<<endl;
+    g_log<<Logger::Error<<"DNS parser error "<<makeLoginfo(dc) <<": "<<dc->d_mdp.d_qname<<", "<<e.what()<<endl;
     delete dc;
   }
   catch(std::exception& e) {
-    L<<Logger::Error<<"STL error "<< makeLoginfo(dc)<<": "<<e.what();
+    g_log<<Logger::Error<<"STL error "<< makeLoginfo(dc)<<": "<<e.what();
 
     // Luawrapper nests the exception from Lua, so we unnest it here
     try {
         std::rethrow_if_nested(e);
     } catch(const std::exception& ne) {
-        L<<". Extra info: "<<ne.what();
+        g_log<<". Extra info: "<<ne.what();
     } catch(...) {}
 
-    L<<endl;
+    g_log<<endl;
     delete dc;
   }
   catch(...) {
-    L<<Logger::Error<<"Any other exception in a resolver context "<< makeLoginfo(dc) <<endl;
+    g_log<<Logger::Error<<"Any other exception in a resolver context "<< makeLoginfo(dc) <<endl;
   }
 
   g_stats.maxMThreadStackUsage = max(MT->getMaxStackUsage(), g_stats.maxMThreadStackUsage);
@@ -1513,7 +1513,7 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
     }
     if(!bytes || bytes < 0) {
       if(g_logCommonErrors)
-        L<<Logger::Error<<"TCP client "<< conn->d_remote.toStringWithPort() <<" disconnected after first byte"<<endl;
+        g_log<<Logger::Error<<"TCP client "<< conn->d_remote.toStringWithPort() <<" disconnected after first byte"<<endl;
       t_fdm->removeReadFD(fd);
       return;
     }
@@ -1521,7 +1521,7 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
   else if(conn->state==TCPConnection::GETQUESTION) {
     ssize_t bytes=recv(conn->getFD(), conn->data + conn->bytesread, conn->qlen - conn->bytesread, 0);
     if(!bytes || bytes < 0 || bytes > std::numeric_limits<std::uint16_t>::max()) {
-      L<<Logger::Error<<"TCP client "<< conn->d_remote.toStringWithPort() <<" disconnected while reading question body"<<endl;
+      g_log<<Logger::Error<<"TCP client "<< conn->d_remote.toStringWithPort() <<" disconnected while reading question body"<<endl;
       t_fdm->removeReadFD(fd);
       return;
     }
@@ -1536,7 +1536,7 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
       catch(MOADNSException &mde) {
         g_stats.clientParseError++;
         if(g_logCommonErrors)
-          L<<Logger::Error<<"Unable to parse packet from TCP client "<< conn->d_remote.toStringWithPort() <<endl;
+          g_log<<Logger::Error<<"Unable to parse packet from TCP client "<< conn->d_remote.toStringWithPort() <<endl;
         return;
       }
       dc->d_tcpConnection = conn; // carry the torch
@@ -1587,14 +1587,14 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
             }
             catch(const std::exception& e)  {
               if(g_logCommonErrors)
-                L<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl;
+                g_log<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl;
             }
           }
         }
         catch(const std::exception& e)
         {
           if(g_logCommonErrors)
-            L<<Logger::Warning<<"Error parsing a query packet for tag determination, setting tag=0: "<<e.what()<<endl;
+            g_log<<Logger::Warning<<"Error parsing a query packet for tag determination, setting tag=0: "<<e.what()<<endl;
         }
       }
 #ifdef HAVE_PROTOBUF
@@ -1614,19 +1614,19 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
         }
         catch(std::exception& e) {
           if(g_logCommonErrors)
-            L<<Logger::Warning<<"Error parsing a TCP query packet for edns subnet: "<<e.what()<<endl;
+            g_log<<Logger::Warning<<"Error parsing a TCP query packet for edns subnet: "<<e.what()<<endl;
         }
       }
 #endif
       if(dc->d_mdp.d_header.qr) {
         g_stats.ignoredCount++;
-        L<<Logger::Error<<"Ignoring answer from TCP client "<< dc->getRemote() <<" on server socket!"<<endl;
+        g_log<<Logger::Error<<"Ignoring answer from TCP client "<< dc->getRemote() <<" on server socket!"<<endl;
         delete dc;
         return;
       }
       if(dc->d_mdp.d_header.opcode) {
         g_stats.ignoredCount++;
-        L<<Logger::Error<<"Ignoring non-query opcode from TCP client "<< dc->getRemote() <<" on server socket!"<<endl;
+        g_log<<Logger::Error<<"Ignoring non-query opcode from TCP client "<< dc->getRemote() <<" on server socket!"<<endl;
         delete dc;
         return;
       }
@@ -1653,7 +1653,7 @@ static void handleNewTCPQuestion(int fd, FDMultiplexer::funcparam_t& )
         closesocket(newsock);
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing TCP socket after an over capacity drop: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing TCP socket after an over capacity drop: "<<e.reason<<endl;
       }
       return;
     }
@@ -1662,14 +1662,14 @@ static void handleNewTCPQuestion(int fd, FDMultiplexer::funcparam_t& )
       t_remotes->push_back(addr);
     if(t_allowFrom && !t_allowFrom->match(&addr)) {
       if(!g_quiet)
-        L<<Logger::Error<<"["<<MT->getTid()<<"] dropping TCP query from "<<addr.toString()<<", address not matched by allow-from"<<endl;
+        g_log<<Logger::Error<<"["<<MT->getTid()<<"] dropping TCP query from "<<addr.toString()<<", address not matched by allow-from"<<endl;
 
       g_stats.unauthorizedTCP++;
       try {
         closesocket(newsock);
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing TCP socket after an ACL drop: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing TCP socket after an ACL drop: "<<e.reason<<endl;
       }
       return;
     }
@@ -1679,7 +1679,7 @@ static void handleNewTCPQuestion(int fd, FDMultiplexer::funcparam_t& )
         closesocket(newsock); // don't call TCPConnection::closeAndCleanup here - did not enter it in the counts yet!
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing TCP socket after an overflow drop: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing TCP socket after an overflow drop: "<<e.reason<<endl;
       }
       return;
     }
@@ -1781,14 +1781,14 @@ static string* doProcessUDPQuestion(const std::string& question, const ComboAddr
           }
           catch(const std::exception& e)  {
             if(g_logCommonErrors)
-              L<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl;
+              g_log<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl;
           }
         }
       }
       catch(const std::exception& e)
       {
         if(g_logCommonErrors)
-          L<<Logger::Warning<<"Error parsing a query packet for tag determination, setting tag=0: "<<e.what()<<endl;
+          g_log<<Logger::Warning<<"Error parsing a query packet for tag determination, setting tag=0: "<<e.what()<<endl;
       }
     }
 
@@ -1826,7 +1826,7 @@ static string* doProcessUDPQuestion(const std::string& question, const ComboAddr
       }
 #endif /* HAVE_PROTOBUF */
       if(!g_quiet)
-        L<<Logger::Notice<<t_id<< " question answered from packet cache tag="<<ctag<<" from "<<source.toStringWithPort()<<(source != fromaddr ? " (via "+fromaddr.toStringWithPort()+")" : "")<<endl;
+        g_log<<Logger::Notice<<t_id<< " question answered from packet cache tag="<<ctag<<" from "<<source.toStringWithPort()<<(source != fromaddr ? " (via "+fromaddr.toStringWithPort()+")" : "")<<endl;
 
       g_stats.packetCacheHits++;
       SyncRes::s_queries++;
@@ -1841,7 +1841,7 @@ static string* doProcessUDPQuestion(const std::string& question, const ComboAddr
        addCMsgSrcAddr(&msgh, cbuf, &destaddr, 0);
       }
       if(sendmsg(fd, &msgh, 0) < 0 && g_logCommonErrors)
-        L<<Logger::Warning<<"Sending UDP reply to client "<<source.toStringWithPort()<<(source != fromaddr ? " (via "+fromaddr.toStringWithPort()+")" : "")<<" failed with: "<<strerror(errno)<<endl;
+        g_log<<Logger::Warning<<"Sending UDP reply to client "<<source.toStringWithPort()<<(source != fromaddr ? " (via "+fromaddr.toStringWithPort()+")" : "")<<" failed with: "<<strerror(errno)<<endl;
 
       if(response.length() >= sizeof(struct dnsheader)) {
         struct dnsheader tmpdh;
@@ -1854,14 +1854,14 @@ static string* doProcessUDPQuestion(const std::string& question, const ComboAddr
     }
   }
   catch(std::exception& e) {
-    L<<Logger::Error<<"Error processing or aging answer packet: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Error processing or aging answer packet: "<<e.what()<<endl;
     return 0;
   }
 
   if(t_pdl) {
     if(t_pdl->ipfilter(source, destination, *dh)) {
       if(!g_quiet)
-       L<<Logger::Notice<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] DROPPED question from "<<source.toStringWithPort()<<(source != fromaddr ? " (via "+fromaddr.toStringWithPort()+")" : "")<<" based on policy"<<endl;
+       g_log<<Logger::Notice<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] DROPPED question from "<<source.toStringWithPort()<<(source != fromaddr ? " (via "+fromaddr.toStringWithPort()+")" : "")<<" based on policy"<<endl;
       g_stats.policyDrops++;
       return 0;
     }
@@ -1869,7 +1869,7 @@ static string* doProcessUDPQuestion(const std::string& question, const ComboAddr
 
   if(MT->numProcesses() > g_maxMThreads) {
     if(!g_quiet)
-      L<<Logger::Notice<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] DROPPED question from "<<source.toStringWithPort()<<(source != fromaddr ? " (via "+fromaddr.toStringWithPort()+")" : "")<<", over capacity"<<endl;
+      g_log<<Logger::Notice<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] DROPPED question from "<<source.toStringWithPort()<<(source != fromaddr ? " (via "+fromaddr.toStringWithPort()+")" : "")<<", over capacity"<<endl;
 
     g_stats.overCapacityDrops++;
     return 0;
@@ -1928,7 +1928,7 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer::funcparam_t& var)
 
     if(t_allowFrom && !t_allowFrom->match(&fromaddr)) {
       if(!g_quiet)
-        L<<Logger::Error<<"["<<MT->getTid()<<"] dropping UDP query from "<<fromaddr.toString()<<", address not matched by allow-from"<<endl;
+        g_log<<Logger::Error<<"["<<MT->getTid()<<"] dropping UDP query from "<<fromaddr.toString()<<", address not matched by allow-from"<<endl;
 
       g_stats.unauthorizedUDP++;
       return;
@@ -1936,7 +1936,7 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer::funcparam_t& var)
     BOOST_STATIC_ASSERT(offsetof(sockaddr_in, sin_port) == offsetof(sockaddr_in6, sin6_port));
     if(!fromaddr.sin4.sin_port) { // also works for IPv6
      if(!g_quiet)
-        L<<Logger::Error<<"["<<MT->getTid()<<"] dropping UDP query from "<<fromaddr.toStringWithPort()<<", can't deal with port 0"<<endl;
+        g_log<<Logger::Error<<"["<<MT->getTid()<<"] dropping UDP query from "<<fromaddr.toStringWithPort()<<", can't deal with port 0"<<endl;
 
       g_stats.clientParseError++; // not quite the best place to put it, but needs to go somewhere
       return;
@@ -1947,12 +1947,12 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer::funcparam_t& var)
       if(dh->qr) {
         g_stats.ignoredCount++;
         if(g_logCommonErrors)
-          L<<Logger::Error<<"Ignoring answer from "<<fromaddr.toString()<<" on server socket!"<<endl;
+          g_log<<Logger::Error<<"Ignoring answer from "<<fromaddr.toString()<<" on server socket!"<<endl;
       }
       else if(dh->opcode) {
         g_stats.ignoredCount++;
         if(g_logCommonErrors)
-          L<<Logger::Error<<"Ignoring non-query opcode "<<dh->opcode<<" from "<<fromaddr.toString()<<" on server socket!"<<endl;
+          g_log<<Logger::Error<<"Ignoring non-query opcode "<<dh->opcode<<" from "<<fromaddr.toString()<<" on server socket!"<<endl;
       }
       else {
         string question(data, (size_t)len);
@@ -1985,12 +1985,12 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer::funcparam_t& var)
     catch(MOADNSException& mde) {
       g_stats.clientParseError++;
       if(g_logCommonErrors)
-        L<<Logger::Error<<"Unable to parse packet from remote UDP client "<<fromaddr.toString() <<": "<<mde.what()<<endl;
+        g_log<<Logger::Error<<"Unable to parse packet from remote UDP client "<<fromaddr.toString() <<": "<<mde.what()<<endl;
     }
     catch(std::runtime_error& e) {
       g_stats.clientParseError++;
       if(g_logCommonErrors)
-        L<<Logger::Error<<"Unable to parse packet from remote UDP client "<<fromaddr.toString() <<": "<<e.what()<<endl;
+        g_log<<Logger::Error<<"Unable to parse packet from remote UDP client "<<fromaddr.toString() <<": "<<e.what()<<endl;
     }
   }
   else {
@@ -2034,17 +2034,17 @@ static void makeTCPServerSockets(unsigned int threadId)
 
     int tmp=1;
     if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof tmp)<0) {
-      L<<Logger::Error<<"Setsockopt failed for TCP listening socket"<<endl;
+      g_log<<Logger::Error<<"Setsockopt failed for TCP listening socket"<<endl;
       exit(1);
     }
     if(sin.sin6.sin6_family == AF_INET6 && setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &tmp, sizeof(tmp)) < 0) {
-      L<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl;
+      g_log<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl;
     }
 
 #ifdef TCP_DEFER_ACCEPT
     if(setsockopt(fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &tmp, sizeof tmp) >= 0) {
       if(i==locals.begin())
-        L<<Logger::Error<<"Enabled TCP data-ready filter for (slight) DoS protection"<<endl;
+        g_log<<Logger::Error<<"Enabled TCP data-ready filter for (slight) DoS protection"<<endl;
     }
 #endif
 
@@ -2062,10 +2062,10 @@ static void makeTCPServerSockets(unsigned int threadId)
 #ifdef TCP_FASTOPEN
       int fastOpenQueueSize = ::arg().asNum("tcp-fast-open");
       if (setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &fastOpenQueueSize, sizeof fastOpenQueueSize) < 0) {
-        L<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
+        g_log<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
       }
 #else
-      L<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
+      g_log<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
 #endif
     }
 
@@ -2082,9 +2082,9 @@ static void makeTCPServerSockets(unsigned int threadId)
     // we don't need to update g_listenSocketsAddresses since it doesn't work for TCP/IP:
     //  - fd is not that which we know here, but returned from accept()
     if(sin.sin4.sin_family == AF_INET)
-      L<<Logger::Error<<"Listening for TCP queries on "<< sin.toString() <<":"<<st.port<<endl;
+      g_log<<Logger::Error<<"Listening for TCP queries on "<< sin.toString() <<":"<<st.port<<endl;
     else
-      L<<Logger::Error<<"Listening for TCP queries on ["<< sin.toString() <<"]:"<<st.port<<endl;
+      g_log<<Logger::Error<<"Listening for TCP queries on ["<< sin.toString() <<"]:"<<st.port<<endl;
   }
 }
 
@@ -2117,7 +2117,7 @@ static void makeUDPServerSockets(unsigned int threadId)
       throw PDNSException("Making a UDP server socket for resolver: "+netstringerror());
     }
     if (!setSocketTimestamps(fd))
-      L<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
+      g_log<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
 
     if(IsAnyAddress(sin)) {
       if(sin.sin4.sin_family == AF_INET)
@@ -2129,7 +2129,7 @@ static void makeUDPServerSockets(unsigned int threadId)
           g_fromtosockets.insert(fd);
 #endif
       if(sin.sin6.sin6_family == AF_INET6 && setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one)) < 0) {
-       L<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl;
+       g_log<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl;
       }
     }
     if( ::arg().mustDo("non-local-bind") )
@@ -2156,9 +2156,9 @@ static void makeUDPServerSockets(unsigned int threadId)
     deferredAdds[threadId].push_back(make_pair(fd, handleNewUDPQuestion));
     g_listenSocketsAddresses[fd]=sin;  // this is written to only from the startup thread, not from the workers
     if(sin.sin4.sin_family == AF_INET)
-      L<<Logger::Error<<"Listening for UDP queries on "<< sin.toString() <<":"<<st.port<<endl;
+      g_log<<Logger::Error<<"Listening for UDP queries on "<< sin.toString() <<":"<<st.port<<endl;
     else
-      L<<Logger::Error<<"Listening for UDP queries on ["<< sin.toString() <<"]:"<<st.port<<endl;
+      g_log<<Logger::Error<<"Listening for UDP queries on ["<< sin.toString() <<"]:"<<st.port<<endl;
   }
 }
 
@@ -2171,7 +2171,7 @@ static void daemonize(void)
 
   int i=open("/dev/null",O_RDWR); /* open stdin */
   if(i < 0)
-    L<<Logger::Critical<<"Unable to open /dev/null: "<<stringerror()<<endl;
+    g_log<<Logger::Critical<<"Unable to open /dev/null: "<<stringerror()<<endl;
   else {
     dup2(i,0); /* stdin */
     dup2(i,1); /* stderr */
@@ -2201,35 +2201,35 @@ static void doStats(void)
   uint64_t cacheMisses = broadcastAccFunction<uint64_t>(pleaseGetCacheMisses);
 
   if(g_stats.qcounter && (cacheHits + cacheMisses) && SyncRes::s_queries && SyncRes::s_outqueries) {
-    L<<Logger::Notice<<"stats: "<<g_stats.qcounter<<" questions, "<<
+    g_log<<Logger::Notice<<"stats: "<<g_stats.qcounter<<" questions, "<<
       broadcastAccFunction<uint64_t>(pleaseGetCacheSize)<< " cache entries, "<<
       broadcastAccFunction<uint64_t>(pleaseGetNegCacheSize)<<" negative entries, "<<
       (int)((cacheHits*100.0)/(cacheHits+cacheMisses))<<"% cache hits"<<endl;
 
-    L<<Logger::Notice<<"stats: throttle map: "
+    g_log<<Logger::Notice<<"stats: throttle map: "
       << broadcastAccFunction<uint64_t>(pleaseGetThrottleSize) <<", ns speeds: "
       << broadcastAccFunction<uint64_t>(pleaseGetNsSpeedsSize)<<endl;
-    L<<Logger::Notice<<"stats: outpacket/query ratio "<<(int)(SyncRes::s_outqueries*100.0/SyncRes::s_queries)<<"%";
-    L<<Logger::Notice<<", "<<(int)(SyncRes::s_throttledqueries*100.0/(SyncRes::s_outqueries+SyncRes::s_throttledqueries))<<"% throttled, "
+    g_log<<Logger::Notice<<"stats: outpacket/query ratio "<<(int)(SyncRes::s_outqueries*100.0/SyncRes::s_queries)<<"%";
+    g_log<<Logger::Notice<<", "<<(int)(SyncRes::s_throttledqueries*100.0/(SyncRes::s_outqueries+SyncRes::s_throttledqueries))<<"% throttled, "
      <<SyncRes::s_nodelegated<<" no-delegation drops"<<endl;
-    L<<Logger::Notice<<"stats: "<<SyncRes::s_tcpoutqueries<<" outgoing tcp connections, "<<
+    g_log<<Logger::Notice<<"stats: "<<SyncRes::s_tcpoutqueries<<" outgoing tcp connections, "<<
       broadcastAccFunction<uint64_t>(pleaseGetConcurrentQueries)<<" queries running, "<<SyncRes::s_outgoingtimeouts<<" outgoing timeouts"<<endl;
 
-    //L<<Logger::Notice<<"stats: "<<g_stats.ednsPingMatches<<" ping matches, "<<g_stats.ednsPingMismatches<<" mismatches, "<<
+    //g_log<<Logger::Notice<<"stats: "<<g_stats.ednsPingMatches<<" ping matches, "<<g_stats.ednsPingMismatches<<" mismatches, "<<
       //g_stats.noPingOutQueries<<" outqueries w/o ping, "<< g_stats.noEdnsOutQueries<<" w/o EDNS"<<endl;
 
-    L<<Logger::Notice<<"stats: " <<  broadcastAccFunction<uint64_t>(pleaseGetPacketCacheSize) <<
+    g_log<<Logger::Notice<<"stats: " <<  broadcastAccFunction<uint64_t>(pleaseGetPacketCacheSize) <<
     " packet cache entries, "<<(int)(100.0*broadcastAccFunction<uint64_t>(pleaseGetPacketCacheHits)/SyncRes::s_queries) << "% packet cache hits"<<endl;
 
     time_t now = time(0);
     if(lastOutputTime && lastQueryCount && now != lastOutputTime) {
-      L<<Logger::Notice<<"stats: "<< (SyncRes::s_queries - lastQueryCount) / (now - lastOutputTime) <<" qps (average over "<< (now - lastOutputTime) << " seconds)"<<endl;
+      g_log<<Logger::Notice<<"stats: "<< (SyncRes::s_queries - lastQueryCount) / (now - lastOutputTime) <<" qps (average over "<< (now - lastOutputTime) << " seconds)"<<endl;
     }
     lastOutputTime = now;
     lastQueryCount = SyncRes::s_queries;
   }
   else if(statsWanted)
-    L<<Logger::Notice<<"stats: no stats yet!"<<endl;
+    g_log<<Logger::Notice<<"stats: no stats yet!"<<endl;
 
   statsWanted=false;
 }
@@ -2280,19 +2280,19 @@ static void houseKeeping(void *)
        }
        catch(std::exception& e)
         {
-          L<<Logger::Error<<"Exception while performing security poll: "<<e.what()<<endl;
+          g_log<<Logger::Error<<"Exception while performing security poll: "<<e.what()<<endl;
         }
         catch(PDNSException& e)
         {
-          L<<Logger::Error<<"Exception while performing security poll: "<<e.reason<<endl;
+          g_log<<Logger::Error<<"Exception while performing security poll: "<<e.reason<<endl;
         }
         catch(ImmediateServFailException &e)
         {
-          L<<Logger::Error<<"Exception while performing security poll: "<<e.reason<<endl;
+          g_log<<Logger::Error<<"Exception while performing security poll: "<<e.reason<<endl;
         }
         catch(...)
         {
-          L<<Logger::Error<<"Exception while performing security poll"<<endl;
+          g_log<<Logger::Error<<"Exception while performing security poll"<<endl;
         }
 
       }
@@ -2302,7 +2302,7 @@ static void houseKeeping(void *)
   catch(PDNSException& ae)
     {
       s_running=false;
-      L<<Logger::Error<<"Fatal error in housekeeping thread: "<<ae.reason<<endl;
+      g_log<<Logger::Error<<"Fatal error in housekeeping thread: "<<ae.reason<<endl;
       throw;
     }
 }
@@ -2397,11 +2397,11 @@ static void handlePipeRequest(int fd, FDMultiplexer::funcparam_t& var)
   }
   catch(std::exception& e) {
     if(g_logCommonErrors)
-      L<<Logger::Error<<"PIPE function we executed created exception: "<<e.what()<<endl; // but what if they wanted an answer.. we send 0
+      g_log<<Logger::Error<<"PIPE function we executed created exception: "<<e.what()<<endl; // but what if they wanted an answer.. we send 0
   }
   catch(PDNSException& e) {
     if(g_logCommonErrors)
-      L<<Logger::Error<<"PIPE function we executed created PDNS exception: "<<e.reason<<endl; // but what if they wanted an answer.. we send 0
+      g_log<<Logger::Error<<"PIPE function we executed created PDNS exception: "<<e.reason<<endl; // but what if they wanted an answer.. we send 0
   }
   if(tmsg->wantAnswer) {
     if(write(g_pipes[t_id].writeFromThread, &resp, sizeof(resp)) != sizeof(resp)) {
@@ -2502,10 +2502,10 @@ static void handleRCC(int fd, FDMultiplexer::funcparam_t& var)
     command();
   }
   catch(std::exception& e) {
-    L<<Logger::Error<<"Error dealing with control socket request: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Error dealing with control socket request: "<<e.what()<<endl;
   }
   catch(PDNSException& ae) {
-    L<<Logger::Error<<"Error dealing with control socket request: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"Error dealing with control socket request: "<<ae.reason<<endl;
   }
 }
 
@@ -2593,7 +2593,7 @@ static void handleUDPServerResponse(int fd, FDMultiplexer::funcparam_t& var)
     else {
       g_stats.serverParseError++;
       if(g_logCommonErrors)
-        L<<Logger::Error<<"Unable to parse packet from remote UDP server "<< fromaddr.toString() <<
+        g_log<<Logger::Error<<"Unable to parse packet from remote UDP server "<< fromaddr.toString() <<
           ": packet smaller than DNS header"<<endl;
     }
 
@@ -2618,7 +2618,7 @@ static void handleUDPServerResponse(int fd, FDMultiplexer::funcparam_t& var)
   pident.fd=fd;
 
   if(!dh.qr && g_logCommonErrors) {
-    L<<Logger::Notice<<"Not taking data from question on outgoing socket from "<< fromaddr.toStringWithPort()  <<endl;
+    g_log<<Logger::Notice<<"Not taking data from question on outgoing socket from "<< fromaddr.toStringWithPort()  <<endl;
   }
 
   if(!dh.qdcount || // UPC, Nominum, very old BIND on FormErr, NSD
@@ -2633,7 +2633,7 @@ static void handleUDPServerResponse(int fd, FDMultiplexer::funcparam_t& var)
     }
     catch(std::exception& e) {
       g_stats.serverParseError++; // won't be fed to lwres.cc, so we have to increment
-      L<<Logger::Warning<<"Error in packet from remote nameserver "<< fromaddr.toStringWithPort() << ": "<<e.what() << endl;
+      g_log<<Logger::Warning<<"Error in packet from remote nameserver "<< fromaddr.toStringWithPort() << ": "<<e.what() << endl;
       return;
     }
   }
@@ -2664,7 +2664,7 @@ retryWithName:
     }
     g_stats.unexpectedCount++; // if we made it here, it really is an unexpected answer
     if(g_logCommonErrors) {
-      L<<Logger::Warning<<"Discarding unexpected packet from "<<fromaddr.toStringWithPort()<<": "<< (pident.domain.empty() ? "<empty>" : pident.domain.toString())<<", "<<pident.type<<", "<<MT->d_waiters.size()<<" waiters"<<endl;
+      g_log<<Logger::Warning<<"Discarding unexpected packet from "<<fromaddr.toStringWithPort()<<": "<< (pident.domain.empty() ? "<empty>" : pident.domain.toString())<<", "<<pident.type<<", "<<MT->d_waiters.size()<<" waiters"<<endl;
     }
   }
   else if(fd >= 0) {
@@ -2681,13 +2681,13 @@ FDMultiplexer* getMultiplexer()
       return ret;
     }
     catch(FDMultiplexerException &fe) {
-      L<<Logger::Error<<"Non-fatal error initializing possible multiplexer ("<<fe.what()<<"), falling back"<<endl;
+      g_log<<Logger::Error<<"Non-fatal error initializing possible multiplexer ("<<fe.what()<<"), falling back"<<endl;
     }
     catch(...) {
-      L<<Logger::Error<<"Non-fatal error initializing possible multiplexer"<<endl;
+      g_log<<Logger::Error<<"Non-fatal error initializing possible multiplexer"<<endl;
     }
   }
-  L<<Logger::Error<<"No working multiplexer found!"<<endl;
+  g_log<<Logger::Error<<"No working multiplexer found!"<<endl;
   exit(1);
 }
 
@@ -2698,7 +2698,7 @@ static string* doReloadLuaScript()
   try {
     if(fname.empty()) {
       t_pdl.reset();
-      L<<Logger::Error<<t_id<<" Unloaded current lua script"<<endl;
+      g_log<<Logger::Error<<t_id<<" Unloaded current lua script"<<endl;
       return new string("unloaded\n");
     }
     else {
@@ -2707,11 +2707,11 @@ static string* doReloadLuaScript()
     }
   }
   catch(std::exception& e) {
-    L<<Logger::Error<<t_id<<" Retaining current script, error from '"<<fname<<"': "<< e.what() <<endl;
+    g_log<<Logger::Error<<t_id<<" Retaining current script, error from '"<<fname<<"': "<< e.what() <<endl;
     return new string("retaining current script, error from '"+fname+"': "+e.what()+"\n");
   }
 
-  L<<Logger::Warning<<t_id<<" (Re)loaded lua script from '"<<fname<<"'"<<endl;
+  g_log<<Logger::Warning<<t_id<<" (Re)loaded lua script from '"<<fname<<"'"<<endl;
   return new string("(re)loaded '"+fname+"'\n");
 }
 
@@ -2752,7 +2752,7 @@ static void checkLinuxIPv6Limits()
   if(readFileIfThere("/proc/sys/net/ipv6/route/max_size", &line)) {
     int lim=std::stoi(line);
     if(lim < 16384) {
-      L<<Logger::Error<<"If using IPv6, please raise sysctl net.ipv6.route.max_size, currently set to "<<lim<<" which is < 16384"<<endl;
+      g_log<<Logger::Error<<"If using IPv6, please raise sysctl net.ipv6.route.max_size, currently set to "<<lim<<" which is < 16384"<<endl;
     }
   }
 #endif
@@ -2766,11 +2766,11 @@ static void checkOrFixFDS()
     unsigned int hardlimit= getFilenumLimit(true);
     if(hardlimit >= wantFDs) {
       setFilenumLimit(wantFDs);
-      L<<Logger::Warning<<"Raised soft limit on number of filedescriptors to "<<wantFDs<<" to match max-mthreads and threads settings"<<endl;
+      g_log<<Logger::Warning<<"Raised soft limit on number of filedescriptors to "<<wantFDs<<" to match max-mthreads and threads settings"<<endl;
     }
     else {
       int newval = (hardlimit - 25) / g_numWorkerThreads;
-      L<<Logger::Warning<<"Insufficient number of filedescriptors available for max-mthreads*threads setting! ("<<hardlimit<<" < "<<wantFDs<<"), reducing max-mthreads to "<<newval<<endl;
+      g_log<<Logger::Warning<<"Insufficient number of filedescriptors available for max-mthreads*threads setting! ("<<hardlimit<<" < "<<wantFDs<<"), reducing max-mthreads to "<<newval<<endl;
       g_maxMThreads = newval;
       setFilenumLimit(hardlimit);
     }
@@ -2841,24 +2841,24 @@ void parseACLs()
 
       allowFrom->addMask(line);
     }
-    L<<Logger::Warning<<"Done parsing " << allowFrom->size() <<" allow-from ranges from file '"<<::arg()["allow-from-file"]<<"' - overriding 'allow-from' setting"<<endl;
+    g_log<<Logger::Warning<<"Done parsing " << allowFrom->size() <<" allow-from ranges from file '"<<::arg()["allow-from-file"]<<"' - overriding 'allow-from' setting"<<endl;
   }
   else if(!::arg()["allow-from"].empty()) {
     vector<string> ips;
     stringtok(ips, ::arg()["allow-from"], ", ");
 
-    L<<Logger::Warning<<"Only allowing queries from: ";
+    g_log<<Logger::Warning<<"Only allowing queries from: ";
     for(vector<string>::const_iterator i = ips.begin(); i!= ips.end(); ++i) {
       allowFrom->addMask(*i);
       if(i!=ips.begin())
-        L<<Logger::Warning<<", ";
-      L<<Logger::Warning<<*i;
+        g_log<<Logger::Warning<<", ";
+      g_log<<Logger::Warning<<*i;
     }
-    L<<Logger::Warning<<endl;
+    g_log<<Logger::Warning<<endl;
   }
   else {
     if(::arg()["local-address"]!="127.0.0.1" && ::arg().asNum("local-port")==53)
-      L<<Logger::Error<<"WARNING: Allowing queries from all IP addresses - this can be a security risk!"<<endl;
+      g_log<<Logger::Error<<"WARNING: Allowing queries from all IP addresses - this can be a security risk!"<<endl;
     allowFrom = nullptr;
   }
 
@@ -2886,7 +2886,7 @@ static std::map<unsigned int, std::set<int> > parseCPUMap()
   const std::string value = ::arg()["cpu-map"];
 
   if (!value.empty() && !isSettingThreadCPUAffinitySupported()) {
-    L<<Logger::Warning<<"CPU mapping requested but not supported, skipping"<<endl;
+    g_log<<Logger::Warning<<"CPU mapping requested but not supported, skipping"<<endl;
     return result;
   }
 
@@ -2915,7 +2915,7 @@ static std::map<unsigned int, std::set<int> > parseCPUMap()
       }
     }
     catch(const std::exception& e) {
-      L<<Logger::Error<<"Error parsing cpu-map entry '"<<part<<"': "<<e.what()<<endl;
+      g_log<<Logger::Error<<"Error parsing cpu-map entry '"<<part<<"': "<<e.what()<<endl;
     }
   }
 
@@ -2928,34 +2928,34 @@ static void setCPUMap(const std::map<unsigned int, std::set<int> >& cpusMap, uns
   if (cpuMapping != cpusMap.cend()) {
     int rc = mapThreadToCPUList(tid, cpuMapping->second);
     if (rc == 0) {
-      L<<Logger::Info<<"CPU affinity for worker "<<n<<" has been set to CPU map:";
+      g_log<<Logger::Info<<"CPU affinity for worker "<<n<<" has been set to CPU map:";
       for (const auto cpu : cpuMapping->second) {
-        L<<Logger::Info<<" "<<cpu;
+        g_log<<Logger::Info<<" "<<cpu;
       }
-      L<<Logger::Info<<endl;
+      g_log<<Logger::Info<<endl;
     }
     else {
-      L<<Logger::Warning<<"Error setting CPU affinity for worker "<<n<<" to CPU map:";
+      g_log<<Logger::Warning<<"Error setting CPU affinity for worker "<<n<<" to CPU map:";
       for (const auto cpu : cpuMapping->second) {
-        L<<Logger::Info<<" "<<cpu;
+        g_log<<Logger::Info<<" "<<cpu;
       }
-      L<<Logger::Info<<strerror(rc)<<endl;
+      g_log<<Logger::Info<<strerror(rc)<<endl;
     }
   }
 }
 
 static int serviceMain(int argc, char*argv[])
 {
-  L.setName(s_programname);
-  L.disableSyslog(::arg().mustDo("disable-syslog"));
-  L.setTimestamps(::arg().mustDo("log-timestamp"));
+  g_log.setName(s_programname);
+  g_log.disableSyslog(::arg().mustDo("disable-syslog"));
+  g_log.setTimestamps(::arg().mustDo("log-timestamp"));
 
   if(!::arg()["logging-facility"].empty()) {
     int val=logFacilityToLOG(::arg().asNum("logging-facility") );
     if(val >= 0)
-      theL().setFacility(val);
+      g_log.setFacility(val);
     else
-      L<<Logger::Error<<"Unknown logging facility "<<::arg().asNum("logging-facility") <<endl;
+      g_log<<Logger::Error<<"Unknown logging facility "<<::arg().asNum("logging-facility") <<endl;
   }
 
   showProductVersion();
@@ -2968,7 +2968,7 @@ static int serviceMain(int argc, char*argv[])
     vector<string> addrs;
     if(!::arg()["query-local-address6"].empty()) {
       SyncRes::s_doIPv6=true;
-      L<<Logger::Warning<<"Enabling IPv6 transport for outgoing queries"<<endl;
+      g_log<<Logger::Warning<<"Enabling IPv6 transport for outgoing queries"<<endl;
 
       stringtok(addrs, ::arg()["query-local-address6"], ", ;");
       for(const string& addr : addrs) {
@@ -2976,7 +2976,7 @@ static int serviceMain(int argc, char*argv[])
       }
     }
     else {
-      L<<Logger::Warning<<"NOT using IPv6 for outgoing queries - set 'query-local-address6=::' to enable"<<endl;
+      g_log<<Logger::Warning<<"NOT using IPv6 for outgoing queries - set 'query-local-address6=::' to enable"<<endl;
     }
     addrs.clear();
     stringtok(addrs, ::arg()["query-local-address"], ", ;");
@@ -2985,7 +2985,7 @@ static int serviceMain(int argc, char*argv[])
     }
   }
   catch(std::exception& e) {
-    L<<Logger::Error<<"Assigning local query addresses: "<<e.what();
+    g_log<<Logger::Error<<"Assigning local query addresses: "<<e.what();
     exit(99);
   }
 
@@ -3001,7 +3001,7 @@ static int serviceMain(int argc, char*argv[])
   else if(::arg()["dnssec"]=="log-fail")
     g_dnssecmode=DNSSECMode::ValidateForLog;
   else {
-    L<<Logger::Error<<"Unknown DNSSEC mode "<<::arg()["dnssec"]<<endl;
+    g_log<<Logger::Error<<"Unknown DNSSEC mode "<<::arg()["dnssec"]<<endl;
     exit(1);
   }
 
@@ -3015,7 +3015,7 @@ static int serviceMain(int argc, char*argv[])
     loadRecursorLuaConfig(::arg()["lua-config-file"], ::arg().mustDo("daemon"));
   }
   catch (PDNSException &e) {
-    L<<Logger::Error<<"Cannot load Lua configuration: "<<e.reason<<endl;
+    g_log<<Logger::Error<<"Cannot load Lua configuration: "<<e.reason<<endl;
     exit(1);
   }
 
@@ -3028,21 +3028,21 @@ static int serviceMain(int argc, char*argv[])
     ips.push_back("0.0.0.0");
     ips.push_back("::");
 
-    L<<Logger::Warning<<"Will not send queries to: ";
+    g_log<<Logger::Warning<<"Will not send queries to: ";
     for(vector<string>::const_iterator i = ips.begin(); i!= ips.end(); ++i) {
       SyncRes::addDontQuery(*i);
       if(i!=ips.begin())
-        L<<Logger::Warning<<", ";
-      L<<Logger::Warning<<*i;
+        g_log<<Logger::Warning<<", ";
+      g_log<<Logger::Warning<<*i;
     }
-    L<<Logger::Warning<<endl;
+    g_log<<Logger::Warning<<endl;
   }
 
   g_quiet=::arg().mustDo("quiet");
 
   g_weDistributeQueries = ::arg().mustDo("pdns-distributes-queries");
   if(g_weDistributeQueries) {
-      L<<Logger::Warning<<"PowerDNS Recursor itself will distribute queries over threads"<<endl;
+      g_log<<Logger::Warning<<"PowerDNS Recursor itself will distribute queries over threads"<<endl;
   }
 
   setupDelegationOnly();
@@ -3134,7 +3134,7 @@ static int serviceMain(int argc, char*argv[])
 
   g_numWorkerThreads = ::arg().asNum("threads");
   if (g_numWorkerThreads < 1) {
-    L<<Logger::Warning<<"Asked to run with 0 threads, raising to 1 instead"<<endl;
+    g_log<<Logger::Warning<<"Asked to run with 0 threads, raising to 1 instead"<<endl;
     g_numWorkerThreads = 1;
   }
 
@@ -3169,8 +3169,8 @@ static int serviceMain(int argc, char*argv[])
   }
 
   if(::arg().mustDo("daemon")) {
-    L<<Logger::Warning<<"Calling daemonize, going to background"<<endl;
-    L.toConsole(Logger::Critical);
+    g_log<<Logger::Warning<<"Calling daemonize, going to background"<<endl;
+    g_log.toConsole(Logger::Critical);
     daemonize();
     loadRecursorLuaConfig(::arg()["lua-config-file"], false);
   }
@@ -3182,7 +3182,7 @@ static int serviceMain(int argc, char*argv[])
 
 #ifdef HAVE_LIBSODIUM
   if (sodium_init() == -1) {
-    L<<Logger::Error<<"Unable to initialize sodium crypto library"<<endl;
+    g_log<<Logger::Error<<"Unable to initialize sodium crypto library"<<endl;
     exit(99);
   }
 #endif
@@ -3204,16 +3204,16 @@ static int serviceMain(int argc, char*argv[])
      char *ns;
      ns = getenv("NOTIFY_SOCKET");
      if (ns != nullptr) {
-       L<<Logger::Error<<"Unable to chroot when running from systemd. Please disable chroot= or set the 'Type' for this service to 'simple'"<<endl;
+       g_log<<Logger::Error<<"Unable to chroot when running from systemd. Please disable chroot= or set the 'Type' for this service to 'simple'"<<endl;
        exit(1);
      }
 #endif
     if (chroot(::arg()["chroot"].c_str())<0 || chdir("/") < 0) {
-      L<<Logger::Error<<"Unable to chroot to '"+::arg()["chroot"]+"': "<<strerror (errno)<<", exiting"<<endl;
+      g_log<<Logger::Error<<"Unable to chroot to '"+::arg()["chroot"]+"': "<<strerror (errno)<<", exiting"<<endl;
       exit(1);
     }
     else
-      L<<Logger::Error<<"Chrooted to '"<<::arg()["chroot"]<<"'"<<endl;
+      g_log<<Logger::Error<<"Chrooted to '"<<::arg()["chroot"]<<"'"<<endl;
   }
 
   s_pidfname=::arg()["socket-dir"]+"/"+s_programname+".pid";
@@ -3238,13 +3238,13 @@ static int serviceMain(int argc, char*argv[])
 
   int port = ::arg().asNum("udp-source-port-min");
   if(port < 1024 || port > 65535){
-    L<<Logger::Error<<"Unable to launch, udp-source-port-min is not a valid port number"<<endl;
+    g_log<<Logger::Error<<"Unable to launch, udp-source-port-min is not a valid port number"<<endl;
     exit(99); // this isn't going to fix itself either
   }
   s_minUdpSourcePort = port;
   port = ::arg().asNum("udp-source-port-max");
   if(port < 1024 || port > 65535 || port < s_minUdpSourcePort){
-    L<<Logger::Error<<"Unable to launch, udp-source-port-max is not a valid port number or is smaller than udp-source-port-min"<<endl;
+    g_log<<Logger::Error<<"Unable to launch, udp-source-port-max is not a valid port number or is smaller than udp-source-port-min"<<endl;
     exit(99); // this isn't going to fix itself either
   }
   s_maxUdpSourcePort = port;
@@ -3254,7 +3254,7 @@ static int serviceMain(int argc, char*argv[])
   {
     port = std::stoi(part);
     if(port < 1024 || port > 65535){
-      L<<Logger::Error<<"Unable to launch, udp-source-port-avoid contains an invalid port number: "<<part<<endl;
+      g_log<<Logger::Error<<"Unable to launch, udp-source-port-avoid contains an invalid port number: "<<part<<endl;
       exit(99); // this isn't going to fix itself either
     }
     s_avoidUdpSourcePorts.insert(port);
@@ -3262,7 +3262,7 @@ static int serviceMain(int argc, char*argv[])
 
   const auto cpusMap = parseCPUMap();
   if(g_numThreads == 1) {
-    L<<Logger::Warning<<"Operating unthreaded"<<endl;
+    g_log<<Logger::Warning<<"Operating unthreaded"<<endl;
 #ifdef HAVE_SYSTEMD
     sd_notify(0, "READY=1");
 #endif
@@ -3271,7 +3271,7 @@ static int serviceMain(int argc, char*argv[])
   }
   else {
     pthread_t tid;
-    L<<Logger::Warning<<"Launching "<< g_numThreads <<" threads"<<endl;
+    g_log<<Logger::Warning<<"Launching "<< g_numThreads <<" threads"<<endl;
     for(unsigned int n=0; n < g_numThreads; ++n) {
       pthread_create(&tid, 0, recursorThread, (void*)(long)n);
 
@@ -3302,17 +3302,17 @@ try
 #ifdef HAVE_PROTOBUF
   t_uuidGenerator = std::unique_ptr<boost::uuids::random_generator>(new boost::uuids::random_generator());
 #endif
-  L<<Logger::Warning<<"Done priming cache with root hints"<<endl;
+  g_log<<Logger::Warning<<"Done priming cache with root hints"<<endl;
 
   try {
     if(!::arg()["lua-dns-script"].empty()) {
       t_pdl = std::make_shared<RecursorLua4>();
       t_pdl->loadFile(::arg()["lua-dns-script"]);
-      L<<Logger::Warning<<"Loaded 'lua' script from '"<<::arg()["lua-dns-script"]<<"'"<<endl;
+      g_log<<Logger::Warning<<"Loaded 'lua' script from '"<<::arg()["lua-dns-script"]<<"'"<<endl;
     }
   }
   catch(std::exception &e) {
-    L<<Logger::Error<<"Failed to load 'lua' script from '"<<::arg()["lua-dns-script"]<<"': "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Failed to load 'lua' script from '"<<::arg()["lua-dns-script"]<<"': "<<e.what()<<endl;
     _exit(99);
   }
 
@@ -3341,16 +3341,16 @@ try
   t_fdm=getMultiplexer();
   if(!t_id) {
     if(::arg().mustDo("webserver")) {
-      L<<Logger::Warning << "Enabling web server" << endl;
+      g_log<<Logger::Warning << "Enabling web server" << endl;
       try {
         new RecursorWebServer(t_fdm);
       }
       catch(PDNSException &e) {
-        L<<Logger::Error<<"Exception: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Exception: "<<e.reason<<endl;
         exit(99);
       }
     }
-    L<<Logger::Error<<"Enabled '"<< t_fdm->getName() << "' multiplexer"<<endl;
+    g_log<<Logger::Error<<"Enabled '"<< t_fdm->getName() << "' multiplexer"<<endl;
   }
 
   t_fdm->addReadFD(g_pipes[t_id].readToThread, handlePipeRequest);
@@ -3394,7 +3394,7 @@ try
       for(expired_t::iterator i=expired.begin() ; i != expired.end(); ++i) {
         shared_ptr<TCPConnection> conn=any_cast<shared_ptr<TCPConnection> >(i->second);
         if(g_logCommonErrors)
-          L<<Logger::Warning<<"Timeout from remote TCP client "<< conn->d_remote.toStringWithPort() <<endl;
+          g_log<<Logger::Warning<<"Timeout from remote TCP client "<< conn->d_remote.toStringWithPort() <<endl;
         t_fdm->removeReadFD(i->first);
       }
     }
@@ -3434,15 +3434,15 @@ try
   }
 }
 catch(PDNSException &ae) {
-  L<<Logger::Error<<"Exception: "<<ae.reason<<endl;
+  g_log<<Logger::Error<<"Exception: "<<ae.reason<<endl;
   return 0;
 }
 catch(std::exception &e) {
-   L<<Logger::Error<<"STL Exception: "<<e.what()<<endl;
+   g_log<<Logger::Error<<"STL Exception: "<<e.what()<<endl;
    return 0;
 }
 catch(...) {
-   L<<Logger::Error<<"any other exception in main: "<<endl;
+   g_log<<Logger::Error<<"any other exception in main: "<<endl;
    return 0;
 }
 
@@ -3584,7 +3584,7 @@ int main(int argc, char **argv)
     ::arg().setCmd("help","Provide a helpful message");
     ::arg().setCmd("version","Print version string");
     ::arg().setCmd("config","Output blank configuration");
-    L.toConsole(Logger::Info);
+    g_log.toConsole(Logger::Info);
     ::arg().laxParse(argc,argv); // do a lax parse
 
     string configname=::arg()["config-dir"]+"/recursor.conf";
@@ -3605,12 +3605,12 @@ int main(int argc, char **argv)
     }
 
     if(!::arg().file(configname.c_str()))
-      L<<Logger::Warning<<"Unable to parse configuration file '"<<configname<<"'"<<endl;
+      g_log<<Logger::Warning<<"Unable to parse configuration file '"<<configname<<"'"<<endl;
 
     ::arg().parse(argc,argv);
 
     if( !::arg()["chroot"].empty() && !::arg()["api-config-dir"].empty() && !::arg().mustDo("api-readonly") )  {
-      L<<Logger::Error<<"Using chroot and a writable API is not possible"<<endl;
+      g_log<<Logger::Error<<"Using chroot and a writable API is not possible"<<endl;
       exit(EXIT_FAILURE);
     }
 
@@ -3644,21 +3644,21 @@ int main(int argc, char **argv)
     if(!g_quiet && logUrgency < Logger::Info) { // Logger::Info=6, Logger::Debug=7
       logUrgency = Logger::Info;                // if you do --quiet=no, you need Info to also see the query log
     }
-    L.setLoglevel(logUrgency);
-    L.toConsole(logUrgency);
+    g_log.setLoglevel(logUrgency);
+    g_log.toConsole(logUrgency);
 
     serviceMain(argc, argv);
   }
   catch(PDNSException &ae) {
-    L<<Logger::Error<<"Exception: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"Exception: "<<ae.reason<<endl;
     ret=EXIT_FAILURE;
   }
   catch(std::exception &e) {
-    L<<Logger::Error<<"STL Exception: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"STL Exception: "<<e.what()<<endl;
     ret=EXIT_FAILURE;
   }
   catch(...) {
-    L<<Logger::Error<<"any other exception in main: "<<endl;
+    g_log<<Logger::Error<<"any other exception in main: "<<endl;
     ret=EXIT_FAILURE;
   }
 
index 3ebd0bcf5657024d38897676a1e53aa93b29df29..61b51be8269e59795ebd403af42b0e0b7ffd3fbd 100644 (file)
@@ -97,10 +97,10 @@ void loadMainConfig(const std::string& configdir)
   ::arg().set("max-signature-cache-entries", "Maximum number of signatures cache entries")="";
   ::arg().laxFile(configname.c_str());
 
-  L.toConsole(Logger::Error);   // so we print any errors
+  g_log.toConsole(Logger::Error);   // so we print any errors
   BackendMakers().launch(::arg()["launch"]); // vrooooom!
   if(::arg().asNum("loglevel") >= 3) // so you can't kill our errors
-    L.toConsole((Logger::Urgency)::arg().asNum("loglevel"));  
+    g_log.toConsole((Logger::Urgency)::arg().asNum("loglevel"));  
 
   //cerr<<"Backend: "<<::arg()["launch"]<<", '" << ::arg()["gmysql-dbname"] <<"'" <<endl;
 
index 041cb8c177d976ca5b4e3f11482b07d21f5f25c7..55c933774f8421ad26594db13bae0a37ba699e2b 100644 (file)
@@ -212,7 +212,7 @@ class Pkcs11Slot {
     void logError(const std::string& operation) const {
       if (d_err) {
         std::string msg = boost::str( boost::format("PKCS#11 operation %s failed: %s (0x%X)") % operation % p11_kit_strerror(d_err) % d_err );
-        L<<Logger::Error<< msg << endl;
+        g_log<<Logger::Error<< msg << endl;
       }
     }
 
@@ -291,7 +291,7 @@ class Pkcs11Token {
     void logError(const std::string& operation) const {
       if (d_err) {
         std::string msg = boost::str( boost::format("PKCS#11 operation %s failed: %s (0x%X)") % operation % p11_kit_strerror(d_err) % d_err );
-        L<<Logger::Error<< msg << endl;
+        g_log<<Logger::Error<< msg << endl;
       }
     }
 
@@ -353,7 +353,7 @@ class Pkcs11Token {
       attr.push_back(P11KitAttribute(CKA_LABEL, d_label));
       FindObjects2(attr, key, 1);
       if (key.size() == 0) {
-        L<<Logger::Warning<<"Cannot load PCKS#11 private key "<<d_label<<std::endl;;
+        g_log<<Logger::Warning<<"Cannot load PCKS#11 private key "<<d_label<<std::endl;;
         return;
       }
       d_private_key = key[0];
@@ -363,7 +363,7 @@ class Pkcs11Token {
       attr.push_back(P11KitAttribute(CKA_LABEL, d_pub_label));
       FindObjects2(attr, key, 1);
       if (key.size() == 0) {
-        L<<Logger::Warning<<"Cannot load PCKS#11 public key "<<d_pub_label<<std::endl;
+        g_log<<Logger::Warning<<"Cannot load PCKS#11 public key "<<d_pub_label<<std::endl;
         return;
       }
       d_public_key = key[0];
@@ -667,7 +667,7 @@ CK_RV Pkcs11Slot::HuntSlot(const string& tokenId, CK_SLOT_ID &slotId, _CK_SLOT_I
   // this is required by certain tokens, otherwise C_GetSlotInfo will not return a token
   err = functions->C_GetSlotList(CK_FALSE, NULL_PTR, &slots);
   if (err) {
-    L<<Logger::Warning<<"C_GetSlotList(CK_FALSE, NULL_PTR, &slots) = " << err << std::endl;
+    g_log<<Logger::Warning<<"C_GetSlotList(CK_FALSE, NULL_PTR, &slots) = " << err << std::endl;
     return err;
   }
 
@@ -675,7 +675,7 @@ CK_RV Pkcs11Slot::HuntSlot(const string& tokenId, CK_SLOT_ID &slotId, _CK_SLOT_I
   std::vector<CK_SLOT_ID> slotIds(slots);
   err = functions->C_GetSlotList(CK_FALSE, slotIds.data(), &slots);
   if (err) {
-    L<<Logger::Warning<<"C_GetSlotList(CK_FALSE, slotIds, &slots) = " << err << std::endl;
+    g_log<<Logger::Warning<<"C_GetSlotList(CK_FALSE, slotIds, &slots) = " << err << std::endl;
     return err;
   }
 
@@ -685,11 +685,11 @@ CK_RV Pkcs11Slot::HuntSlot(const string& tokenId, CK_SLOT_ID &slotId, _CK_SLOT_I
     if (slotId == static_cast<CK_SLOT_ID>(-1))
       continue;
     if ((err = functions->C_GetSlotInfo(slotId, info))) {
-      L<<Logger::Warning<<"C_GetSlotList("<<slotId<<", info) = " << err << std::endl;
+      g_log<<Logger::Warning<<"C_GetSlotList("<<slotId<<", info) = " << err << std::endl;
       return err;
     }
     if ((err = functions->C_GetTokenInfo(slotId, &tinfo))) {
-      L<<Logger::Warning<<"C_GetSlotList("<<slotId<<", &tinfo) = " << err << std::endl;
+      g_log<<Logger::Warning<<"C_GetSlotList("<<slotId<<", &tinfo) = " << err << std::endl;
       return err;
     }
     std::string slotName;
@@ -706,10 +706,10 @@ CK_RV Pkcs11Slot::HuntSlot(const string& tokenId, CK_SLOT_ID &slotId, _CK_SLOT_I
   try {
     slotId = std::stoi(tokenId);
     if ((err = functions->C_GetSlotInfo(slotId, info))) {
-      L<<Logger::Warning<<"C_GetSlotList("<<slotId<<", info) = " << err << std::endl;
+      g_log<<Logger::Warning<<"C_GetSlotList("<<slotId<<", info) = " << err << std::endl;
       return err;
     }
-    L<<Logger::Warning<<"Specifying PKCS#11 token by SLOT ID is deprecated and should not be used"<<std::endl;
+    g_log<<Logger::Warning<<"Specifying PKCS#11 token by SLOT ID is deprecated and should not be used"<<std::endl;
     return 0;
   } catch (...) {
     return CKR_SLOT_ID_INVALID;
@@ -873,7 +873,7 @@ std::string PKCS11DNSCryptoKeyEngine::hash(const std::string& msg) const {
       throw PDNSException("Not logged in to token");
 
   if (d_slot->Digest(msg, result, &mech)) {
-    L<<Logger::Error<<"Could not digest using PKCS#11 token - using software workaround"<<endl;
+    g_log<<Logger::Error<<"Could not digest using PKCS#11 token - using software workaround"<<endl;
     // FINE! I'll do this myself, then, shall I?
     switch(d_algorithm) {
     case 5: {
index 8d8b2db57b8d1ea8d980cd38e4d8567861f687cc..97f091134bae4eddab9ee2f02098c255c2c45904 100644 (file)
 
 void seedRandom(const string& source)
 {
-  L<<Logger::Warning<<"Reading random entropy from '"<<source<<"'"<<endl;
+  g_log<<Logger::Warning<<"Reading random entropy from '"<<source<<"'"<<endl;
 
   int fd=open(source.c_str(), O_RDONLY);
   if(fd < 0) {
-    L<<Logger::Error<<"Unable to open source of random '"<<source<<"': "<<stringerror()<<endl;
+    g_log<<Logger::Error<<"Unable to open source of random '"<<source<<"': "<<stringerror()<<endl;
     exit(EXIT_FAILURE);
   }
   char seed[16];
@@ -24,12 +24,12 @@ void seedRandom(const string& source)
   while(pos!=sizeof(seed)) {
     ret = read(fd, seed+pos, sizeof(seed)-pos);
     if(ret < 0) { 
-      L<<Logger::Error<<"Unable to read random seed from "<<source<<": "<<stringerror()<<endl;
+      g_log<<Logger::Error<<"Unable to read random seed from "<<source<<": "<<stringerror()<<endl;
       close(fd);
       exit(EXIT_FAILURE);
     }
     if(!ret) {
-      L<<Logger::Error<<"Unable to read random seed from "<<source<<": end of file"<<endl;
+      g_log<<Logger::Error<<"Unable to read random seed from "<<source<<": end of file"<<endl;
       close(fd);
       exit(EXIT_FAILURE);
     }
index 5cf085ba9e816b2767a5d5a13863e7bf703cbcd4..69e75a8898d64ba66ec53dbefcd7be6cb75b57ae 100644 (file)
@@ -60,20 +60,20 @@ try
 
     int ret=asendtcp(msg, &s);     // this will actually do the right thing waiting on the connect
     if(ret < 0)
-      L<<Logger::Warning<<"Error writing carbon data to "<<remote.toStringWithPort()<<": "<<strerror(errno)<<endl;
+      g_log<<Logger::Warning<<"Error writing carbon data to "<<remote.toStringWithPort()<<": "<<strerror(errno)<<endl;
     if(ret==0)
-      L<<Logger::Warning<<"Timeout connecting/writing carbon data to "<<remote.toStringWithPort()<<endl;
+      g_log<<Logger::Warning<<"Timeout connecting/writing carbon data to "<<remote.toStringWithPort()<<endl;
   }
  }
 catch(PDNSException& e)
 {
-  L<<Logger::Error<<"Error in carbon thread: "<<e.reason<<endl;
+  g_log<<Logger::Error<<"Error in carbon thread: "<<e.reason<<endl;
 }
 catch(std::exception& e)
 {
-  L<<Logger::Error<<"Error in carbon thread: "<<e.what()<<endl;
+  g_log<<Logger::Error<<"Error in carbon thread: "<<e.what()<<endl;
 }
 catch(...)
 {
-  L<<Logger::Error<<"Unknown error in carbon thread"<<endl;
+  g_log<<Logger::Error<<"Unknown error in carbon thread"<<endl;
 }
index e42ce1f4b5eccdcba75a4520bfec57335232d0f8..04b082bc65315c688a52bb1691f5f77409eb232d 100644 (file)
@@ -123,14 +123,14 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
             zone->reserve(zoneSizeHint);
           }
         }
-        theL()<<Logger::Warning<<"Loading RPZ from file '"<<filename<<"'"<<endl;
+        g_log<<Logger::Warning<<"Loading RPZ from file '"<<filename<<"'"<<endl;
         zone->setName(polName);
         loadRPZFromFile(filename, zone, defpol, maxTTL);
         lci.dfe.addZone(zone);
-        theL()<<Logger::Warning<<"Done loading RPZ from file '"<<filename<<"'"<<endl;
+        g_log<<Logger::Warning<<"Done loading RPZ from file '"<<filename<<"'"<<endl;
       }
       catch(const std::exception& e) {
-        theL()<<Logger::Error<<"Unable to load RPZ zone from '"<<filename<<"': "<<e.what()<<endl;
+        g_log<<Logger::Error<<"Unable to load RPZ zone from '"<<filename<<"': "<<e.what()<<endl;
       }
     });
 
@@ -186,11 +186,11 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
         zoneIdx = lci.dfe.addZone(zone);
       }
       catch(const std::exception& e) {
-        theL()<<Logger::Error<<"Problem configuring 'rpzMaster': "<<e.what()<<endl;
+        g_log<<Logger::Error<<"Problem configuring 'rpzMaster': "<<e.what()<<endl;
         exit(1);  // FIXME proper exit code?
       }
       catch(const PDNSException& e) {
-        theL()<<Logger::Error<<"Problem configuring 'rpzMaster': "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Problem configuring 'rpzMaster': "<<e.reason<<endl;
         exit(1);  // FIXME proper exit code?
       }
 
@@ -201,11 +201,11 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
           }
       }
       catch(const std::exception& e) {
-        theL()<<Logger::Error<<"Problem starting RPZIXFRTracker thread: "<<e.what()<<endl;
+        g_log<<Logger::Error<<"Problem starting RPZIXFRTracker thread: "<<e.what()<<endl;
         exit(1);  // FIXME proper exit code?
       }
       catch(const PDNSException& e) {
-        theL()<<Logger::Error<<"Problem starting RPZIXFRTracker thread: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Problem starting RPZIXFRTracker thread: "<<e.reason<<endl;
         exit(1);  // FIXME proper exit code?
       }
     });
@@ -238,7 +238,7 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
                        }
                      }
                      catch(std::exception& e) {
-                       theL()<<Logger::Error<<"Error in addSortList: "<<e.what()<<endl;
+                       g_log<<Logger::Error<<"Error in addSortList: "<<e.what()<<endl;
                      }
                    });
 
@@ -293,14 +293,14 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
           }
         }
         else {
-          theL()<<Logger::Error<<"Only one protobuf server can be configured, we already have "<<lci.protobufServer->toString()<<endl;
+          g_log<<Logger::Error<<"Only one protobuf server can be configured, we already have "<<lci.protobufServer->toString()<<endl;
         }
       }
       catch(std::exception& e) {
-       theL()<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.what()<<endl;
+       g_log<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.what()<<endl;
       }
       catch(PDNSException& e) {
-        theL()<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.reason<<endl;
       }
     });
 
@@ -313,14 +313,14 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
           }
         }
         else {
-          theL()<<Logger::Error<<"Only one protobuf server can be configured, we already have "<<lci.protobufServer->toString()<<endl;
+          g_log<<Logger::Error<<"Only one protobuf server can be configured, we already have "<<lci.protobufServer->toString()<<endl;
         }
       }
       catch(std::exception& e) {
-       theL()<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.what()<<endl;
+       g_log<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.what()<<endl;
       }
       catch(PDNSException& e) {
-        theL()<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.reason<<endl;
       }
     });
 #endif
@@ -330,22 +330,22 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
     g_luaconfs.setState(lci);
   }
   catch(const LuaContext::ExecutionErrorException& e) {
-    theL()<<Logger::Error<<"Unable to load Lua script from '"+fname+"': ";
+    g_log<<Logger::Error<<"Unable to load Lua script from '"+fname+"': ";
     try {
       std::rethrow_if_nested(e);
     } catch(const std::exception& exp) {
       // exp is the exception that was thrown from inside the lambda
-      theL() << exp.what() << std::endl;
+      g_log << exp.what() << std::endl;
     }
     catch(const PDNSException& exp) {
       // exp is the exception that was thrown from inside the lambda
-      theL() << exp.reason << std::endl;
+      g_log << exp.reason << std::endl;
     }
     throw;
 
   }
   catch(std::exception& err) {
-    theL()<<Logger::Error<<"Unable to load Lua script from '"+fname+"': "<<err.what()<<endl;
+    g_log<<Logger::Error<<"Unable to load Lua script from '"+fname+"': "<<err.what()<<endl;
     throw;
   }
 
index e2ad7e9a293e2dd587e21ba1a00be02e0fd7cc1f..537e1852b316baf8a9a66cb9ebfa9eb44f5af21d 100644 (file)
@@ -144,12 +144,12 @@ static int handleCounter64Stats(netsnmp_mib_handler* handler,
 static void registerCounter64Stat(const char* name, const oid statOID[], size_t statOIDLength)
 {
   if (statOIDLength != OID_LENGTH(questionsOID)) {
-    L<<Logger::Error<<"Invalid OID for SNMP Counter64 statistic "<<std::string(name)<<endl;
+    g_log<<Logger::Error<<"Invalid OID for SNMP Counter64 statistic "<<std::string(name)<<endl;
     return;
   }
 
   if (s_statsMap.find(statOID[statOIDLength - 1]) != s_statsMap.end()) {
-    L<<Logger::Error<<"OID for SNMP Counter64 statistic "<<std::string(name)<<" has already been registered"<<endl;
+    g_log<<Logger::Error<<"OID for SNMP Counter64 statistic "<<std::string(name)<<" has already been registered"<<endl;
     return;
   }
 
index 4108e93ecb6f69d08caf499cb3da143d348bdd52..40e287e68af525e762adc74a538f574ac77feaea 100644 (file)
@@ -384,7 +384,7 @@ string doSetDnssecLogBogus(T begin, T end)
 
   if (pdns_iequals(*begin, "on") || pdns_iequals(*begin, "yes")) {
     if (!g_dnssecLogBogus) {
-      L<<Logger::Warning<<"Enabling DNSSEC Bogus logging, requested via control channel"<<endl;
+      g_log<<Logger::Warning<<"Enabling DNSSEC Bogus logging, requested via control channel"<<endl;
       g_dnssecLogBogus = true;
       return "DNSSEC Bogus logging enabled\n";
     }
@@ -393,7 +393,7 @@ string doSetDnssecLogBogus(T begin, T end)
 
   if (pdns_iequals(*begin, "off") || pdns_iequals(*begin, "no")) {
     if (g_dnssecLogBogus) {
-      L<<Logger::Warning<<"Disabling DNSSEC Bogus logging, requested via control channel"<<endl;
+      g_log<<Logger::Warning<<"Disabling DNSSEC Bogus logging, requested via control channel"<<endl;
       g_dnssecLogBogus = false;
       return "DNSSEC Bogus logging disabled\n";
     }
@@ -431,7 +431,7 @@ string doAddNTA(T begin, T end)
     if (begin != end)
       why += " ";
   }
-  L<<Logger::Warning<<"Adding Negative Trust Anchor for "<<who<<" with reason '"<<why<<"', requested via control channel"<<endl;
+  g_log<<Logger::Warning<<"Adding Negative Trust Anchor for "<<who<<" with reason '"<<why<<"', requested via control channel"<<endl;
   g_luaconfs.modify([who, why](LuaConfigItems& lci) {
       lci.negAnchors[who] = why;
       });
@@ -449,7 +449,7 @@ string doClearNTA(T begin, T end)
     return "No Negative Trust Anchor specified, doing nothing.\n";
 
   if (begin + 1 == end && *begin == "*"){
-    L<<Logger::Warning<<"Clearing all Negative Trust Anchors, requested via control channel"<<endl;
+    g_log<<Logger::Warning<<"Clearing all Negative Trust Anchors, requested via control channel"<<endl;
     g_luaconfs.modify([](LuaConfigItems& lci) {
         lci.negAnchors.clear();
       });
@@ -477,7 +477,7 @@ string doClearNTA(T begin, T end)
   string removed("");
   bool first(true);
   for (auto const &entry : toRemove) {
-    L<<Logger::Warning<<"Clearing Negative Trust Anchor for "<<entry<<", requested via control channel"<<endl;
+    g_log<<Logger::Warning<<"Clearing Negative Trust Anchor for "<<entry<<", requested via control channel"<<endl;
     g_luaconfs.modify([entry](LuaConfigItems& lci) {
         lci.negAnchors.erase(entry);
       });
@@ -531,17 +531,17 @@ string doAddTA(T begin, T end)
   }
 
   try {
-    L<<Logger::Warning<<"Adding Trust Anchor for "<<who<<" with data '"<<what<<"', requested via control channel";
+    g_log<<Logger::Warning<<"Adding Trust Anchor for "<<who<<" with data '"<<what<<"', requested via control channel";
     g_luaconfs.modify([who, what](LuaConfigItems& lci) {
       auto ds = unique_ptr<DSRecordContent>(dynamic_cast<DSRecordContent*>(DSRecordContent::make(what)));
       lci.dsAnchors[who].insert(*ds);
       });
     broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, who, true));
-    L<<Logger::Warning<<endl;
+    g_log<<Logger::Warning<<endl;
     return "Added Trust Anchor for " + who.toStringRootDot() + " with data " + what + "\n";
   }
   catch(std::exception &e) {
-    L<<Logger::Warning<<", failed: "<<e.what()<<endl;
+    g_log<<Logger::Warning<<", failed: "<<e.what()<<endl;
     return "Unable to add Trust Anchor for " + who.toStringRootDot() + ": " + e.what() + "\n";
   }
 }
@@ -576,7 +576,7 @@ string doClearTA(T begin, T end)
   string removed("");
   bool first(true);
   for (auto const &entry : toRemove) {
-    L<<Logger::Warning<<"Removing Trust Anchor for "<<entry<<", requested via control channel"<<endl;
+    g_log<<Logger::Warning<<"Removing Trust Anchor for "<<entry<<", requested via control channel"<<endl;
     g_luaconfs.modify([entry](LuaConfigItems& lci) {
         lci.dsAnchors.erase(entry);
       });
@@ -983,7 +983,7 @@ void registerAllStats()
 
 static void doExitGeneric(bool nicely)
 {
-  L<<Logger::Error<<"Exiting on user request"<<endl;
+  g_log<<Logger::Error<<"Exiting on user request"<<endl;
   extern RecursorControlChannel s_rcc;
   s_rcc.~RecursorControlChannel(); 
 
@@ -1304,7 +1304,7 @@ string RecursorControlParser::getAnswer(const string& question, RecursorControlP
 
     try {
       loadRecursorLuaConfig(::arg()["lua-config-file"], false);
-      L<<Logger::Warning<<"Reloaded Lua configuration file '"<<::arg()["lua-config-file"]<<"', requested via control channel"<<endl;
+      g_log<<Logger::Warning<<"Reloaded Lua configuration file '"<<::arg()["lua-config-file"]<<"', requested via control channel"<<endl;
       return "Reloaded Lua configuration file '"+::arg()["lua-config-file"]+"'\n";
     }
     catch(std::exception& e) {
@@ -1329,7 +1329,7 @@ string RecursorControlParser::getAnswer(const string& question, RecursorControlP
 
   if(cmd=="reload-acls") {
     if(!::arg()["chroot"].empty()) {
-      L<<Logger::Error<<"Unable to reload ACL when chroot()'ed, requested via control channel"<<endl;
+      g_log<<Logger::Error<<"Unable to reload ACL when chroot()'ed, requested via control channel"<<endl;
       return "Unable to reload ACL when chroot()'ed, please restart\n";
     }
 
@@ -1338,12 +1338,12 @@ string RecursorControlParser::getAnswer(const string& question, RecursorControlP
     } 
     catch(std::exception& e) 
     {
-      L<<Logger::Error<<"Reloading ACLs failed (Exception: "<<e.what()<<")"<<endl;
+      g_log<<Logger::Error<<"Reloading ACLs failed (Exception: "<<e.what()<<")"<<endl;
       return e.what() + string("\n");
     }
     catch(PDNSException& ae)
     {
-      L<<Logger::Error<<"Reloading ACLs failed (PDNSException: "<<ae.reason<<")"<<endl;
+      g_log<<Logger::Error<<"Reloading ACLs failed (PDNSException: "<<ae.reason<<")"<<endl;
       return ae.reason + string("\n");
     }
     return "ok\n";
@@ -1382,7 +1382,7 @@ string RecursorControlParser::getAnswer(const string& question, RecursorControlP
 
   if(cmd=="reload-zones") {
     if(!::arg()["chroot"].empty()) {
-      L<<Logger::Error<<"Unable to reload zones and forwards when chroot()'ed, requested via control channel"<<endl;
+      g_log<<Logger::Error<<"Unable to reload zones and forwards when chroot()'ed, requested via control channel"<<endl;
       return "Unable to reload zones and forwards when chroot()'ed, please restart\n";
     }
     return reloadAuthAndForwards();
index 841bbcc741df128406c17b96b74c68f4c80b7d4e..c20abdc6fe2325c03eb429e2100cc3a9d80cfa0a 100644 (file)
@@ -89,10 +89,6 @@ const char *funnytext=
 
 // start (sys)logging
 
-/** \var Logger L 
-\brief All logging is done via L, a Logger instance
-*/
-
 
 /**
 \file receiver.cc
@@ -110,7 +106,7 @@ void daemonize(void)
 
   int i=open("/dev/null",O_RDWR); /* open stdin */
   if(i < 0) 
-    L<<Logger::Critical<<"Unable to open /dev/null: "<<stringerror()<<endl;
+    g_log<<Logger::Critical<<"Unable to open /dev/null: "<<stringerror()<<endl;
   else {
     dup2(i,0); /* stdin */
     dup2(i,1); /* stderr */
@@ -123,7 +119,7 @@ static int cpid;
 static void takedown(int i)
 {
   if(cpid) {
-    L<<Logger::Error<<"Guardian is killed, taking down children with us"<<endl;
+    g_log<<Logger::Error<<"Guardian is killed, taking down children with us"<<endl;
     kill(cpid,SIGKILL);
     exit(0);
   }
@@ -149,7 +145,7 @@ static void writePid(void)
   if(of)
     of<<getpid()<<endl;
   else
-    L<<Logger::Error<<"Writing pid for "<<getpid()<<" to "<<fname<<" failed: "<<strerror(errno)<<endl;
+    g_log<<Logger::Error<<"Writing pid for "<<getpid()<<" to "<<fname<<" failed: "<<strerror(errno)<<endl;
 }
 
 int g_fd1[2], g_fd2[2];
@@ -223,12 +219,12 @@ static int guardian(int argc, char **argv)
     setStatus("Launching child");
     
     if(pipe(g_fd1)<0 || pipe(g_fd2)<0) {
-      L<<Logger::Critical<<"Unable to open pipe for coprocess: "<<strerror(errno)<<endl;
+      g_log<<Logger::Critical<<"Unable to open pipe for coprocess: "<<strerror(errno)<<endl;
       exit(1);
     }
 
     if(!(g_fp=fdopen(g_fd2[0],"r"))) {
-      L<<Logger::Critical<<"Unable to associate a file pointer with pipe: "<<stringerror()<<endl;
+      g_log<<Logger::Critical<<"Unable to associate a file pointer with pipe: "<<stringerror()<<endl;
       exit(1);
     }
     setbuf(g_fp,0); // no buffering please, confuses select
@@ -245,7 +241,7 @@ static int guardian(int argc, char **argv)
 
       if(::arg()["config-name"]!="") {
         progname+="-"+::arg()["config-name"];
-        L<<Logger::Error<<"Virtual configuration name: "<<::arg()["config-name"]<<endl;
+        g_log<<Logger::Error<<"Virtual configuration name: "<<::arg()["config-name"]<<endl;
       }
 
       newargv[0]=strdup(const_cast<char *>((progname+"-instance").c_str()));
@@ -254,7 +250,7 @@ static int guardian(int argc, char **argv)
       }
       newargv[n]=0;
       
-      L<<Logger::Error<<"Guardian is launching an instance"<<endl;
+      g_log<<Logger::Error<<"Guardian is launching an instance"<<endl;
       close(g_fd1[1]);
       fclose(g_fp); // this closes g_fd2[0] for us
 
@@ -268,14 +264,14 @@ static int guardian(int argc, char **argv)
         close(g_fd2[1]);
       }
       if(execvp(argv[0], newargv)<0) {
-        L<<Logger::Error<<"Unable to execvp '"<<argv[0]<<"': "<<strerror(errno)<<endl;
+        g_log<<Logger::Error<<"Unable to execvp '"<<argv[0]<<"': "<<strerror(errno)<<endl;
         char **p=newargv;
         while(*p)
-          L<<Logger::Error<<*p++<<endl;
+          g_log<<Logger::Error<<*p++<<endl;
 
         exit(1);
       }
-      L<<Logger::Error<<"execvp returned!!"<<endl;
+      g_log<<Logger::Error<<"execvp returned!!"<<endl;
       // never reached
     }
     else if(pid>0) { // parent
@@ -299,8 +295,8 @@ static int guardian(int argc, char **argv)
         int ret=waitpid(pid,&status,WNOHANG);
 
         if(ret<0) {
-          L<<Logger::Error<<"In guardian loop, waitpid returned error: "<<strerror(errno)<<endl;
-          L<<Logger::Error<<"Dying"<<endl;
+          g_log<<Logger::Error<<"In guardian loop, waitpid returned error: "<<strerror(errno)<<endl;
+          g_log<<Logger::Error<<"Dying"<<endl;
           exit(1);
         }
         else if(ret) // something exited
@@ -323,11 +319,11 @@ static int guardian(int argc, char **argv)
         int ret=WEXITSTATUS(status);
 
         if(ret==99) {
-          L<<Logger::Error<<"Child requested a stop, exiting"<<endl;
+          g_log<<Logger::Error<<"Child requested a stop, exiting"<<endl;
           exit(1);
         }
         setStatus("Child died with code "+itoa(ret));
-        L<<Logger::Error<<"Our pdns instance exited with code "<<ret<<", respawning"<<endl;
+        g_log<<Logger::Error<<"Our pdns instance exited with code "<<ret<<", respawning"<<endl;
 
         sleep(1);
         continue;
@@ -335,20 +331,20 @@ static int guardian(int argc, char **argv)
       if(WIFSIGNALED(status)) {
         int sig=WTERMSIG(status);
         setStatus("Child died because of signal "+itoa(sig));
-        L<<Logger::Error<<"Our pdns instance ("<<pid<<") exited after signal "<<sig<<endl;
+        g_log<<Logger::Error<<"Our pdns instance ("<<pid<<") exited after signal "<<sig<<endl;
 #ifdef WCOREDUMP
         if(WCOREDUMP(status)) 
-          L<<Logger::Error<<"Dumped core"<<endl;
+          g_log<<Logger::Error<<"Dumped core"<<endl;
 #endif
 
-        L<<Logger::Error<<"Respawning"<<endl;
+        g_log<<Logger::Error<<"Respawning"<<endl;
         sleep(1);
         continue;
       }
-      L<<Logger::Error<<"No clue what happened! Respawning"<<endl;
+      g_log<<Logger::Error<<"No clue what happened! Respawning"<<endl;
     }
     else {
-      L<<Logger::Error<<"Unable to fork: "<<strerror(errno)<<endl;
+      g_log<<Logger::Error<<"Unable to fork: "<<strerror(errno)<<endl;
       exit(1);
     }
   }
@@ -384,7 +380,7 @@ static void loadModules()
         res=UeberBackend::loadmodule(::arg()["module-dir"]+"/"+module);
       
       if(res==false) {
-        L<<Logger::Error<<"Receiver unable to load module "<<module<<endl;
+        g_log<<Logger::Error<<"Receiver unable to load module "<<module<<endl;
         exit(1);
       }
     }
@@ -395,7 +391,7 @@ static void loadModules()
 #include <execinfo.h>
 static void tbhandler(int num)
 {
-  L<<Logger::Critical<<"Got a signal "<<num<<", attempting to print trace: "<<endl;
+  g_log<<Logger::Critical<<"Got a signal "<<num<<", attempting to print trace: "<<endl;
   void *array[20]; //only care about last 17 functions (3 taken with tracing support)
   size_t size;
   char **strings;
@@ -405,7 +401,7 @@ static void tbhandler(int num)
   strings = backtrace_symbols (array, size); //Need -rdynamic gcc (linker) flag for this to work
   
   for (i = 0; i < size; i++) //skip useless functions
-    L<<Logger::Error<<strings[i]<<endl;
+    g_log<<Logger::Error<<strings[i]<<endl;
   
   
   signal(SIGABRT, SIG_DFL);
@@ -432,7 +428,7 @@ int main(int argc, char **argv)
 
   std::ios_base::sync_with_stdio(false);
 
-  L.toConsole(Logger::Warning);
+  g_log.toConsole(Logger::Warning);
   try {
     declareArguments();
     UNIX_declareArguments();
@@ -448,7 +444,7 @@ int main(int argc, char **argv)
     if(::arg()["config-name"]!="") 
       s_programname+="-"+::arg()["config-name"];
     
-    (void)theL(s_programname);
+    g_log.setName(s_programname);
     
     string configname=::arg()["config-dir"]+"/"+s_programname+".conf";
     cleanSlashes(configname);
@@ -460,15 +456,15 @@ int main(int argc, char **argv)
     if(!::arg()["logging-facility"].empty()) {
       int val=logFacilityToLOG(::arg().asNum("logging-facility") );
       if(val >= 0)
-        theL().setFacility(val);
+        g_log.setFacility(val);
       else
-        L<<Logger::Error<<"Unknown logging facility "<<::arg().asNum("logging-facility") <<endl;
+        g_log<<Logger::Error<<"Unknown logging facility "<<::arg().asNum("logging-facility") <<endl;
     }
 
-    L.setLoglevel((Logger::Urgency)(::arg().asNum("loglevel")));
-    L.disableSyslog(::arg().mustDo("disable-syslog"));
-    L.setTimestamps(::arg().mustDo("log-timestamp"));
-    L.toConsole((Logger::Urgency)(::arg().asNum("loglevel")));  
+    g_log.setLoglevel((Logger::Urgency)(::arg().asNum("loglevel")));
+    g_log.disableSyslog(::arg().mustDo("disable-syslog"));
+    g_log.setTimestamps(::arg().mustDo("log-timestamp"));
+    g_log.toConsole((Logger::Urgency)(::arg().asNum("loglevel")));  
 
     if(::arg().mustDo("help") || ::arg().mustDo("config")) {
       ::arg().set("daemon")="no";
@@ -477,7 +473,7 @@ int main(int argc, char **argv)
 
     if(::arg().mustDo("guardian") && !isGuarded(argv)) {
       if(::arg().mustDo("daemon")) {
-        L.toConsole(Logger::Critical);
+        g_log.toConsole(Logger::Critical);
         daemonize();
       }
       guardian(argc, argv);  
@@ -490,7 +486,7 @@ int main(int argc, char **argv)
 
 #ifdef __GLIBC__
     if(!::arg().mustDo("traceback-handler")) {
-      L<<Logger::Warning<<"Disabling traceback handler"<<endl;
+      g_log<<Logger::Warning<<"Disabling traceback handler"<<endl;
       signal(SIGSEGV,SIG_DFL);
       signal(SIGFPE,SIG_DFL);
       signal(SIGABRT,SIG_DFL);
@@ -539,25 +535,25 @@ int main(int argc, char **argv)
     }
 
     if(!::arg().asNum("local-port")) {
-      L<<Logger::Error<<"Unable to launch, binding to no port or port 0 makes no sense"<<endl;
+      g_log<<Logger::Error<<"Unable to launch, binding to no port or port 0 makes no sense"<<endl;
       exit(99); // this isn't going to fix itself either
     }
     if(!BackendMakers().numLauncheable()) {
-      L<<Logger::Error<<"Unable to launch, no backends configured for querying"<<endl;
+      g_log<<Logger::Error<<"Unable to launch, no backends configured for querying"<<endl;
       exit(99); // this isn't going to fix itself either
     }    
     if(::arg().mustDo("daemon")) {
-      L.toConsole(Logger::None);
+      g_log.toConsole(Logger::None);
       if(!isGuarded(argv))
         daemonize();
     }
 
     if(isGuarded(argv)) {
-      L<<Logger::Warning<<"This is a guarded instance of pdns"<<endl;
+      g_log<<Logger::Warning<<"This is a guarded instance of pdns"<<endl;
       dl=new DynListener; // listens on stdin 
     }
     else {
-      L<<Logger::Warning<<"This is a standalone pdns"<<endl; 
+      g_log<<Logger::Warning<<"This is a standalone pdns"<<endl; 
       
       if(::arg().mustDo("control-console"))
         dl=new DynListener();
@@ -615,7 +611,7 @@ int main(int argc, char **argv)
           g_udpReceivers[idx] = std::make_shared<UDPNameserver>(true);
         }
         catch(const PDNSException& e) {
-          L<<Logger::Error<<"Unable to reuse port, falling back to original bind"<<endl;
+          g_log<<Logger::Error<<"Unable to reuse port, falling back to original bind"<<endl;
           break;
         }
       }
@@ -625,12 +621,12 @@ int main(int argc, char **argv)
       TN=new TCPNameserver; 
   }
   catch(const ArgException &A) {
-    L<<Logger::Error<<"Fatal error: "<<A.reason<<endl;
+    g_log<<Logger::Error<<"Fatal error: "<<A.reason<<endl;
     exit(1);
   }
   
   declareStats();
-  DLOG(L<<Logger::Warning<<"Verbose logging in effect"<<endl);
+  DLOG(g_log<<Logger::Warning<<"Verbose logging in effect"<<endl);
 
   showProductVersion();
 
@@ -640,12 +636,12 @@ int main(int argc, char **argv)
   catch(PDNSException &AE) {
     if(!::arg().mustDo("daemon"))
       cerr<<"Exiting because: "<<AE.reason<<endl;
-    L<<Logger::Error<<"Exiting because: "<<AE.reason<<endl;
+    g_log<<Logger::Error<<"Exiting because: "<<AE.reason<<endl;
   }      
   catch(std::exception &e) {
     if(!::arg().mustDo("daemon"))
       cerr<<"Exiting because of STL error: "<<e.what()<<endl;
-    L<<Logger::Error<<"Exiting because of STL error: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Exiting because of STL error: "<<e.what()<<endl;
   }
   catch(...) {
     cerr<<"Uncaught exception of unknown type - sorry"<<endl;
index 9f53ca5724c91a432980d28f4232f1017076189d..afbee5e572916a3c2fb481f7eecde79928d3e6a7 100644 (file)
@@ -30,7 +30,6 @@
 #include <iostream>
 #include "dnsrecords.hh"
 #include <boost/utility.hpp>
-#undef L
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/hashed_index.hpp>
@@ -42,7 +41,6 @@
 #include "validate.hh"
 #undef max
 
-#define L theL()
 #include "namespaces.hh"
 using namespace ::boost::multi_index;
 
index 04f73ddc08a39e6a253de0f2d2791435641717d9..d63b4caafdb16fc7a399a1b731883547913f10fd 100644 (file)
@@ -101,16 +101,16 @@ LuaConfigItems::LuaConfigItems()
 
 static void init(bool debug=false)
 {
-  L.setName("test");
-  L.disableSyslog(true);
+  g_log.setName("test");
+  g_log.disableSyslog(true);
 
   if (debug) {
-    L.setLoglevel((Logger::Urgency)(6)); // info and up
-    L.toConsole(Logger::Info);
+    g_log.setLoglevel((Logger::Urgency)(6)); // info and up
+    g_log.toConsole(Logger::Info);
   }
   else {
-    L.setLoglevel(Logger::None);
-    L.toConsole(Logger::Error);
+    g_log.setLoglevel(Logger::None);
+    g_log.toConsole(Logger::Error);
   }
 
   seedRandom("/dev/urandom");
index 52eaa8abc3d63e11ff28f8e9f5bfd1b00e510eb0..364b710da27c12b1d2ea26cf024cd1403cbee335 100644 (file)
@@ -119,10 +119,10 @@ static void makeNameToIPZone(std::shared_ptr<SyncRes::domainmap_t> newMap, const
   ad.d_records.insert(dr);
   
   if(newMap->count(dr.d_name)) {  
-    L<<Logger::Warning<<"Hosts file will not overwrite zone '"<<dr.d_name<<"' already loaded"<<endl;
+    g_log<<Logger::Warning<<"Hosts file will not overwrite zone '"<<dr.d_name<<"' already loaded"<<endl;
   }
   else {
-    L<<Logger::Warning<<"Inserting forward zone '"<<dr.d_name<<"' based on hosts file"<<endl;
+    g_log<<Logger::Warning<<"Inserting forward zone '"<<dr.d_name<<"' based on hosts file"<<endl;
     ad.d_name=dr.d_name;
     (*newMap)[ad.d_name]=ad;
   }
@@ -165,11 +165,11 @@ static void makeIPToNamesZone(std::shared_ptr<SyncRes::domainmap_t> newMap, cons
     }
 
   if(newMap->count(dr.d_name)) {  
-    L<<Logger::Warning<<"Will not overwrite zone '"<<dr.d_name<<"' already loaded"<<endl;
+    g_log<<Logger::Warning<<"Will not overwrite zone '"<<dr.d_name<<"' already loaded"<<endl;
   }
   else {
     if(ipparts.size()==4)
-      L<<Logger::Warning<<"Inserting reverse zone '"<<dr.d_name<<"' based on hosts file"<<endl;
+      g_log<<Logger::Warning<<"Inserting reverse zone '"<<dr.d_name<<"' based on hosts file"<<endl;
     ad.d_name = dr.d_name;
     (*newMap)[ad.d_name]=ad;
   }
@@ -215,15 +215,15 @@ void convertServersForAD(const std::string& input, SyncRes::AuthDomain& ad, cons
 
   for(vector<string>::const_iterator iter = servers.begin(); iter != servers.end(); ++iter) {
     if(verbose && iter != servers.begin()) 
-      L<<", ";
+      g_log<<", ";
 
     ComboAddress addr=parseIPAndPort(*iter, 53);
     if(verbose)
-      L<<addr.toStringWithPort();
+      g_log<<addr.toStringWithPort();
     ad.d_servers.push_back(addr);
   }
   if(verbose)
-    L<<endl;
+    g_log<<endl;
 }
 
 void* pleaseWipeNegCache()
@@ -243,7 +243,7 @@ string reloadAuthAndForwards()
   std::shared_ptr<SyncRes::domainmap_t> original=SyncRes::getDomainMap();
   
   try {
-    L<<Logger::Warning<<"Reloading zones, purging data from cache"<<endl;
+    g_log<<Logger::Warning<<"Reloading zones, purging data from cache"<<endl;
 
     if (original) {
       for(const auto& i : *original) {
@@ -302,13 +302,13 @@ string reloadAuthAndForwards()
     return "ok\n";
   }
   catch(std::exception& e) {
-    L<<Logger::Error<<"Encountered error reloading zones, keeping original data: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Encountered error reloading zones, keeping original data: "<<e.what()<<endl;
   }
   catch(PDNSException& ae) {
-    L<<Logger::Error<<"Encountered error reloading zones, keeping original data: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"Encountered error reloading zones, keeping original data: "<<ae.reason<<endl;
   }
   catch(...) {
-    L<<Logger::Error<<"Encountered unknown error reloading zones, keeping original data"<<endl;
+    g_log<<Logger::Error<<"Encountered unknown error reloading zones, keeping original data"<<endl;
   }
   return "reloading failed, see log\n";
 }
@@ -336,7 +336,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForwards()
       // headers.first=toCanonic("", headers.first);
       if(n==0) {
         ad.d_rdForward = false;
-        L<<Logger::Error<<"Parsing authoritative data for zone '"<<headers.first<<"' from file '"<<headers.second<<"'"<<endl;
+        g_log<<Logger::Error<<"Parsing authoritative data for zone '"<<headers.first<<"' from file '"<<headers.second<<"'"<<endl;
         ZoneParserTNG zpt(headers.second, DNSName(headers.first));
         DNSResourceRecord rr;
        DNSRecord dr;
@@ -356,13 +356,13 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForwards()
         }
       }
       else {
-        L<<Logger::Error<<"Redirecting queries for zone '"<<headers.first<<"' ";
+        g_log<<Logger::Error<<"Redirecting queries for zone '"<<headers.first<<"' ";
         if(n == 2) {
-          L<<"with recursion ";
+          g_log<<"with recursion ";
           ad.d_rdForward = true;
         }
         else ad.d_rdForward = false;
-        L<<"to: ";
+        g_log<<"to: ";
         
         convertServersForAD(headers.second, ad, ";");
         if(n == 2) {
@@ -376,7 +376,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForwards()
   }
   
   if(!::arg()["forward-zones-file"].empty()) {
-    L<<Logger::Warning<<"Reading zone forwarding information from '"<<::arg()["forward-zones-file"]<<"'"<<endl;
+    g_log<<Logger::Warning<<"Reading zone forwarding information from '"<<::arg()["forward-zones-file"]<<"'"<<endl;
     SyncRes::AuthDomain ad;
     FILE *rfp=fopen(::arg()["forward-zones-file"].c_str(), "r");
 
@@ -421,7 +421,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForwards()
       ad.d_name = DNSName(domain);
       (*newMap)[ad.d_name]=ad;
     }
-    L<<Logger::Warning<<"Done parsing " << newMap->size() - before<<" forwarding instructions from file '"<<::arg()["forward-zones-file"]<<"'"<<endl;
+    g_log<<Logger::Warning<<"Done parsing " << newMap->size() - before<<" forwarding instructions from file '"<<::arg()["forward-zones-file"]<<"'"<<endl;
   }
 
   if(::arg().mustDo("export-etc-hosts")) {
@@ -430,7 +430,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForwards()
     
     ifstream ifs(fname.c_str());
     if(!ifs) {
-      L<<Logger::Warning<<"Could not open /etc/hosts for reading"<<endl;
+      g_log<<Logger::Warning<<"Could not open /etc/hosts for reading"<<endl;
     }
     else {
       string searchSuffix = ::arg()["export-etc-hosts-search-suffix"];
@@ -462,7 +462,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForwards()
     }
   }
   if(::arg().mustDo("serve-rfc1918")) {
-    L<<Logger::Warning<<"Inserting rfc 1918 private space zones"<<endl;
+    g_log<<Logger::Warning<<"Inserting rfc 1918 private space zones"<<endl;
     parts.clear();
     parts.push_back("127");
     makeIPToNamesZone(newMap, parts);
index 6c472e7745cd3fb85058db5c5a7c51fa8e605b5d..9cda5925e2d15d81fab5bda3d5b2149704f41cc9 100644 (file)
@@ -22,7 +22,7 @@ bool RemoteLogger::reconnect()
   }
   catch(const std::exception& e) {
 #ifdef WE_ARE_RECURSOR
-    L<<Logger::Warning<<"Error connecting to remote logger "<<d_remote.toStringWithPort()<<": "<<e.what()<<std::endl;
+    g_log<<Logger::Warning<<"Error connecting to remote logger "<<d_remote.toStringWithPort()<<": "<<e.what()<<std::endl;
 #else
     warnlog("Error connecting to remote logger %s: %s", d_remote.toStringWithPort(), e.what());
 #endif
@@ -63,7 +63,7 @@ void RemoteLogger::worker()
     }
     catch(const std::runtime_error& e) {
 #ifdef WE_ARE_RECURSOR
-      L<<Logger::Info<<"Error sending data to remote logger "<<d_remote.toStringWithPort()<<": "<< e.what()<<endl;
+      g_log<<Logger::Info<<"Error sending data to remote logger "<<d_remote.toStringWithPort()<<": "<< e.what()<<endl;
 #else
       vinfolog("Error sending data to remote logger (%s): %s", d_remote.toStringWithPort(), e.what());
 #endif
index 9b61e8ae19749b342314cdaf15dae7a5a11b8c0a..ed8e381ac2da5bd8f965da8bddade10c8d512c3a 100644 (file)
@@ -94,17 +94,17 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
   QType rrType = QType(rr->d_type);
 
   if (rrType == QType::NSEC || rrType == QType::NSEC3) {
-    L<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.getName()<<". These are generated records, ignoring!"<<endl;
+    g_log<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.getName()<<". These are generated records, ignoring!"<<endl;
     return 0;
   }
 
   if (!isPresigned && ((!::arg().mustDo("direct-dnskey") && rrType == QType::DNSKEY) || rrType == QType::RRSIG)) {
-    L<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.getName()<<" in non-presigned zone, ignoring!"<<endl;
+    g_log<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.getName()<<" in non-presigned zone, ignoring!"<<endl;
     return 0;
   }
 
   if ((rrType == QType::NSEC3PARAM || rrType == QType::DNSKEY) && rr->d_name != di->zone) {
-    L<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.getName()<<", "<<rrType.getName()<<" must be at zone apex, ignoring!"<<endl;
+    g_log<<Logger::Warning<<msgPrefix<<"Trying to add/update/delete "<<rr->d_name<<"|"<<rrType.getName()<<", "<<rrType.getName()<<" must be at zone apex, ignoring!"<<endl;
     return 0;
   }
 
@@ -116,10 +116,10 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
 
 
   if (rr->d_class == QClass::IN) { // 3.4.2.2 QClass::IN means insert or update
-    DLOG(L<<msgPrefix<<"Add/Update record (QClass == IN) "<<rr->d_name<<"|"<<rrType.getName()<<endl);
+    DLOG(g_log<<msgPrefix<<"Add/Update record (QClass == IN) "<<rr->d_name<<"|"<<rrType.getName()<<endl);
 
     if (rrType == QType::NSEC3PARAM) {
-      L<<Logger::Notice<<msgPrefix<<"Adding/updating NSEC3PARAM for zone, resetting ordernames."<<endl;
+      g_log<<Logger::Notice<<msgPrefix<<"Adding/updating NSEC3PARAM for zone, resetting ordernames."<<endl;
 
       NSEC3PARAMRecordContent nsec3param(rr->d_content->getZoneRepresentation(), di->zone.toString() /* FIXME400 huh */);
       *narrow = false; // adding a NSEC3 will cause narrow mode to be dropped, as you cannot specify that in a NSEC3PARAM record
@@ -189,9 +189,9 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
           di->backend->replaceRRSet(di->id, oldRec->qname, oldRec->qtype, rrset);
           *updatedSerial = true;
           changedRecords++;
-          L<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
         } else {
-          L<<Logger::Notice<<msgPrefix<<"Provided serial ("<<sdUpdate.serial<<") is older than the current serial ("<<sdOld.serial<<"), ignoring SOA update."<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Provided serial ("<<sdUpdate.serial<<") is older than the current serial ("<<sdOld.serial<<"), ignoring SOA update."<<endl;
         }
 
       // It's not possible to have multiple CNAME's with the same NAME. So we always update.
@@ -206,10 +206,10 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
         }
         if (changedCNames > 0) {
           di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset);
-          L<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
           changedRecords += changedCNames;
         } else {
-          L<<Logger::Notice<<msgPrefix<<"Replace for record "<<rr->d_name<<"|"<<rrType.getName()<<" requested, but no changes made."<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replace for record "<<rr->d_name<<"|"<<rrType.getName()<<" requested, but no changes made."<<endl;
         }
 
       // In any other case, we must check if the TYPE and RDATA match to provide an update (which effectively means a update of TTL)
@@ -228,10 +228,10 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
         }
         if (updateTTL > 0) {
           di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset);
-          L<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
           changedRecords += updateTTL;
         } else {
-          L<<Logger::Notice<<msgPrefix<<"Replace for record "<<rr->d_name<<"|"<<rrType.getName()<<" requested, but no changes made."<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replace for record "<<rr->d_name<<"|"<<rrType.getName()<<" requested, but no changes made."<<endl;
         }
       }
 
@@ -268,7 +268,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
 
     // If we haven't found a record that matches, we must add it.
     if (! foundRecord) {
-      L<<Logger::Notice<<msgPrefix<<"Adding record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+      g_log<<Logger::Notice<<msgPrefix<<"Adding record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
       delnonterm.insert(rr->d_name); // always remove any ENT's in the place where we're going to add a record.
       auto newRec = DNSResourceRecord::fromWire(*rr);
       newRec.domain_id = di->id;
@@ -345,7 +345,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
       // If we insert an NS, all the records below it become non auth - so, we're inserting a delegate.
       // Auth can only be false when the rr->d_name is not the zone
       if (auth == false && rrType == QType::NS) {
-        DLOG(L<<msgPrefix<<"Going to fix auth flags below "<<rr->d_name<<endl);
+        DLOG(g_log<<msgPrefix<<"Going to fix auth flags below "<<rr->d_name<<endl);
         insnonterm.clear(); // No ENT's are needed below delegates (auth=0)
         vector<DNSName> qnames;
         di->backend->listSubZone(rr->d_name, di->id);
@@ -383,10 +383,10 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
   // Delete records - section 3.4.2.3 and 3.4.2.4 with the exception of the 'always leave 1 NS rule' as that's handled by
   // the code that calls this performUpdate().
   if ((rr->d_class == QClass::ANY || rr->d_class == QClass::NONE) && rrType != QType::SOA) { // never delete a SOA.
-    DLOG(L<<msgPrefix<<"Deleting records: "<<rr->d_name<<"; QClass:"<<rr->d_class<<"; rrType: "<<rrType.getName()<<endl);
+    DLOG(g_log<<msgPrefix<<"Deleting records: "<<rr->d_name<<"; QClass:"<<rr->d_class<<"; rrType: "<<rrType.getName()<<endl);
 
     if (rrType == QType::NSEC3PARAM) {
-      L<<Logger::Notice<<msgPrefix<<"Deleting NSEC3PARAM from zone, resetting ordernames."<<endl;
+      g_log<<Logger::Notice<<msgPrefix<<"Deleting NSEC3PARAM from zone, resetting ordernames."<<endl;
       if (rr->d_class == QClass::ANY)
         d_dk.unsetNSEC3PARAM(rr->d_name);
       else if (rr->d_class == QClass::NONE) {
@@ -462,7 +462,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
   
     if (recordsToDelete.size()) {
       di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset);
-      L<<Logger::Notice<<msgPrefix<<"Deleting record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
+      g_log<<Logger::Notice<<msgPrefix<<"Deleting record "<<rr->d_name<<"|"<<rrType.getName()<<endl;
       changedRecords += recordsToDelete.size();
 
 
@@ -551,7 +551,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
         }
       }
     } else { // if (recordsToDelete.size())
-      L<<Logger::Notice<<msgPrefix<<"Deletion for record "<<rr->d_name<<"|"<<rrType.getName()<<" requested, but not found."<<endl;
+      g_log<<Logger::Notice<<msgPrefix<<"Deletion for record "<<rr->d_name<<"|"<<rrType.getName()<<" requested, but not found."<<endl;
     }
   } // (End of delete block d_class == ANY || d_class == NONE
   
@@ -559,7 +559,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
 
   //Insert and delete ENT's
   if (insnonterm.size() > 0 || delnonterm.size() > 0) {
-    DLOG(L<<msgPrefix<<"Updating ENT records - "<<insnonterm.size()<<"|"<<delnonterm.size()<<endl);
+    DLOG(g_log<<msgPrefix<<"Updating ENT records - "<<insnonterm.size()<<"|"<<delnonterm.size()<<endl);
     di->backend->updateEmptyNonTerminals(di->id, insnonterm, delnonterm, false);
     for (const auto &i: insnonterm) {
       string hashed;
@@ -581,18 +581,18 @@ int PacketHandler::forwardPacket(const string &msgPrefix, DNSPacket *p, DomainIn
   B.getDomainMetadata(p->qdomain, "FORWARD-DNSUPDATE", forward);
 
   if (forward.size() == 0 && ! ::arg().mustDo("forward-dnsupdate")) {
-    L<<Logger::Notice<<msgPrefix<<"Not configured to forward to master, returning Refused."<<endl;
+    g_log<<Logger::Notice<<msgPrefix<<"Not configured to forward to master, returning Refused."<<endl;
     return RCode::Refused;
   }
 
   for(vector<string>::const_iterator master=di->masters.begin(); master != di->masters.end(); master++) {
-    L<<Logger::Notice<<msgPrefix<<"Forwarding packet to master "<<*master<<endl;
+    g_log<<Logger::Notice<<msgPrefix<<"Forwarding packet to master "<<*master<<endl;
     ComboAddress remote;
     try {
       remote = ComboAddress(*master, 53);
     }
     catch (...) {
-      L<<Logger::Error<<msgPrefix<<"Failed to parse "<<*master<<" as valid remote."<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Failed to parse "<<*master<<" as valid remote."<<endl;
       continue;
     }
 
@@ -606,17 +606,17 @@ int PacketHandler::forwardPacket(const string &msgPrefix, DNSPacket *p, DomainIn
     }
     int sock = makeQuerySocket(local, false); // create TCP socket. RFC2136 section 6.2 seems to be ok with this.
     if(sock < 0) {
-      L<<Logger::Error<<msgPrefix<<"Error creating socket: "<<stringerror()<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Error creating socket: "<<stringerror()<<endl;
       continue;
     }
 
     if( connect(sock, (struct sockaddr*)&remote, remote.getSocklen()) < 0 ) {
-      L<<Logger::Error<<msgPrefix<<"Failed to connect to "<<remote.toStringWithPort()<<": "<<stringerror()<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Failed to connect to "<<remote.toStringWithPort()<<": "<<stringerror()<<endl;
       try {
         closesocket(sock);
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing master forwarding socket after connect() failed: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing master forwarding socket after connect() failed: "<<e.reason<<endl;
       }
       continue;
     }
@@ -628,34 +628,34 @@ int PacketHandler::forwardPacket(const string &msgPrefix, DNSPacket *p, DomainIn
     string buffer((const char*)&len, 2);
     buffer.append(forwardPacket.getString());
     if(write(sock, buffer.c_str(), buffer.length()) < 0) {
-      L<<Logger::Error<<msgPrefix<<"Unable to forward update message to "<<remote.toStringWithPort()<<", error:"<<stringerror()<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Unable to forward update message to "<<remote.toStringWithPort()<<", error:"<<stringerror()<<endl;
       try {
         closesocket(sock);
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing master forwarding socket after write() failed: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing master forwarding socket after write() failed: "<<e.reason<<endl;
       }
       continue;
     }
 
     int res = waitForData(sock, 10, 0);
     if (!res) {
-      L<<Logger::Error<<msgPrefix<<"Timeout waiting for reply from master at "<<remote.toStringWithPort()<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Timeout waiting for reply from master at "<<remote.toStringWithPort()<<endl;
       try {
         closesocket(sock);
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing master forwarding socket after a timeout occured: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing master forwarding socket after a timeout occured: "<<e.reason<<endl;
       }
       continue;
     }
     if (res < 0) {
-      L<<Logger::Error<<msgPrefix<<"Error waiting for answer from master at "<<remote.toStringWithPort()<<", error:"<<stringerror()<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Error waiting for answer from master at "<<remote.toStringWithPort()<<", error:"<<stringerror()<<endl;
       try {
         closesocket(sock);
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing master forwarding socket after an error occured: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing master forwarding socket after an error occured: "<<e.reason<<endl;
       }
       continue;
     }
@@ -664,12 +664,12 @@ int PacketHandler::forwardPacket(const string &msgPrefix, DNSPacket *p, DomainIn
     ssize_t recvRes;
     recvRes = recv(sock, &lenBuf, sizeof(lenBuf), 0);
     if (recvRes < 0 || static_cast<size_t>(recvRes) < sizeof(lenBuf)) {
-      L<<Logger::Error<<msgPrefix<<"Could not receive data (length) from master at "<<remote.toStringWithPort()<<", error:"<<stringerror()<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Could not receive data (length) from master at "<<remote.toStringWithPort()<<", error:"<<stringerror()<<endl;
       try {
         closesocket(sock);
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing master forwarding socket after recv() failed: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing master forwarding socket after recv() failed: "<<e.reason<<endl;
       }
       continue;
     }
@@ -678,12 +678,12 @@ int PacketHandler::forwardPacket(const string &msgPrefix, DNSPacket *p, DomainIn
     buffer.resize(packetLen);
     recvRes = recv(sock, &buffer.at(0), packetLen, 0);
     if (recvRes < 0) {
-      L<<Logger::Error<<msgPrefix<<"Could not receive data (dnspacket) from master at "<<remote.toStringWithPort()<<", error:"<<stringerror()<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Could not receive data (dnspacket) from master at "<<remote.toStringWithPort()<<", error:"<<stringerror()<<endl;
       try {
         closesocket(sock);
       }
       catch(const PDNSException& e) {
-        L<<Logger::Error<<"Error closing master forwarding socket after recv() failed: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"Error closing master forwarding socket after recv() failed: "<<e.reason<<endl;
       }
       continue;
     }
@@ -691,20 +691,20 @@ int PacketHandler::forwardPacket(const string &msgPrefix, DNSPacket *p, DomainIn
       closesocket(sock);
     }
     catch(const PDNSException& e) {
-      L<<Logger::Error<<"Error closing master forwarding socket: "<<e.reason<<endl;
+      g_log<<Logger::Error<<"Error closing master forwarding socket: "<<e.reason<<endl;
     }
 
     try {
       MOADNSParser mdp(false, buffer.data(), static_cast<unsigned int>(recvRes));
-      L<<Logger::Info<<msgPrefix<<"Forward update message to "<<remote.toStringWithPort()<<", result was RCode "<<mdp.d_header.rcode<<endl;
+      g_log<<Logger::Info<<msgPrefix<<"Forward update message to "<<remote.toStringWithPort()<<", result was RCode "<<mdp.d_header.rcode<<endl;
       return mdp.d_header.rcode;
     }
     catch (...) {
-      L<<Logger::Error<<msgPrefix<<"Failed to parse response packet from master at "<<remote.toStringWithPort()<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Failed to parse response packet from master at "<<remote.toStringWithPort()<<endl;
       continue;
     }
   }
-  L<<Logger::Error<<msgPrefix<<"Failed to forward packet to master(s). Returning ServFail."<<endl;
+  g_log<<Logger::Error<<msgPrefix<<"Failed to forward packet to master(s). Returning ServFail."<<endl;
   return RCode::ServFail;
 
 }
@@ -714,7 +714,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
     return RCode::Refused;
 
   string msgPrefix="UPDATE (" + itoa(p->d.id) + ") from " + p->getRemote().toString() + " for " + p->qdomain.toLogString() + ": ";
-  L<<Logger::Info<<msgPrefix<<"Processing started."<<endl;
+  g_log<<Logger::Info<<msgPrefix<<"Processing started."<<endl;
 
   // if there is policy, we delegate all checks to it
   if (this->d_update_policy_lua == NULL) {
@@ -730,7 +730,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
       ng.addMask(*i);
 
     if ( ! ng.match(&p->d_remote)) {
-      L<<Logger::Error<<msgPrefix<<"Remote not listed in allow-dnsupdate-from or domainmetadata. Sending REFUSED"<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Remote not listed in allow-dnsupdate-from or domainmetadata. Sending REFUSED"<<endl;
       return RCode::Refused;
     }
 
@@ -745,7 +745,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
       DNSName inputkey;
       string message;
       if (! p->getTSIGDetails(&trc,  &inputkey)) {
-        L<<Logger::Error<<msgPrefix<<"TSIG key required, but packet does not contain key. Sending REFUSED"<<endl;
+        g_log<<Logger::Error<<msgPrefix<<"TSIG key required, but packet does not contain key. Sending REFUSED"<<endl;
         return RCode::Refused;
       }
 
@@ -767,13 +767,13 @@ int PacketHandler::processUpdate(DNSPacket *p) {
       }
 
       if (!validKey) {
-        L<<Logger::Error<<msgPrefix<<"TSIG key ("<<inputkey<<") required, but no matching key found in domainmetadata, tried "<<tsigKeys.size()<<". Sending REFUSED"<<endl;
+        g_log<<Logger::Error<<msgPrefix<<"TSIG key ("<<inputkey<<") required, but no matching key found in domainmetadata, tried "<<tsigKeys.size()<<". Sending REFUSED"<<endl;
         return RCode::Refused;
       }
     }
 
     if (tsigKeys.size() == 0 && p->d_havetsig)
-      L<<Logger::Warning<<msgPrefix<<"TSIG is provided, but domain is not secured with TSIG. Processing continues"<<endl;
+      g_log<<Logger::Warning<<msgPrefix<<"TSIG is provided, but domain is not secured with TSIG. Processing continues"<<endl;
 
   }
 
@@ -782,24 +782,24 @@ int PacketHandler::processUpdate(DNSPacket *p) {
   // variable names during the use of our MOADNSParser.
   MOADNSParser mdp(false, p->getString());
   if (mdp.d_header.qdcount != 1) {
-    L<<Logger::Warning<<msgPrefix<<"Zone Count is not 1, sending FormErr"<<endl;
+    g_log<<Logger::Warning<<msgPrefix<<"Zone Count is not 1, sending FormErr"<<endl;
     return RCode::FormErr;
   }
 
   if (p->qtype.getCode() != QType::SOA) { // RFC2136 2.3 - ZTYPE must be SOA
-    L<<Logger::Warning<<msgPrefix<<"Query ZTYPE is not SOA, sending FormErr"<<endl;
+    g_log<<Logger::Warning<<msgPrefix<<"Query ZTYPE is not SOA, sending FormErr"<<endl;
     return RCode::FormErr;
   }
 
   if (p->qclass != QClass::IN) {
-    L<<Logger::Warning<<msgPrefix<<"Class is not IN, sending NotAuth"<<endl;
+    g_log<<Logger::Warning<<msgPrefix<<"Class is not IN, sending NotAuth"<<endl;
     return RCode::NotAuth;
   }
 
   DomainInfo di;
   di.backend=0;
   if(!B.getDomainInfo(p->qdomain, di) || !di.backend) {
-    L<<Logger::Error<<msgPrefix<<"Can't determine backend for domain '"<<p->qdomain<<"' (or backend does not support DNS update operation)"<<endl;
+    g_log<<Logger::Error<<msgPrefix<<"Can't determine backend for domain '"<<p->qdomain<<"' (or backend does not support DNS update operation)"<<endl;
     return RCode::NotAuth;
   }
 
@@ -815,16 +815,16 @@ int PacketHandler::processUpdate(DNSPacket *p) {
       continue;
 
     if (!rr->d_name.isPartOf(di.zone)) {
-      L<<Logger::Error<<msgPrefix<<"Received update/record out of zone, sending NotZone."<<endl;
+      g_log<<Logger::Error<<msgPrefix<<"Received update/record out of zone, sending NotZone."<<endl;
       return RCode::NotZone;
     }
   }
 
 
   Lock l(&s_rfc2136lock); //TODO: i think this lock can be per zone, not for everything
-  L<<Logger::Info<<msgPrefix<<"starting transaction."<<endl;
+  g_log<<Logger::Info<<msgPrefix<<"starting transaction."<<endl;
   if (!di.backend->startTransaction(p->qdomain, -1)) { // Not giving the domain_id means that we do not delete the existing records.
-    L<<Logger::Error<<msgPrefix<<"Backend for domain "<<p->qdomain<<" does not support transaction. Can't do Update packet."<<endl;
+    g_log<<Logger::Error<<msgPrefix<<"Backend for domain "<<p->qdomain<<" does not support transaction. Can't do Update packet."<<endl;
     return RCode::NotImp;
   }
 
@@ -834,7 +834,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
     if (rr->d_place == DNSResourceRecord::ANSWER) {
       int res = checkUpdatePrerequisites(rr, &di);
       if (res>0) {
-        L<<Logger::Error<<msgPrefix<<"Failed PreRequisites check, returning "<<RCode::to_s(res)<<endl;
+        g_log<<Logger::Error<<msgPrefix<<"Failed PreRequisites check, returning "<<RCode::to_s(res)<<endl;
         di.backend->abortTransaction();
         return res;
       }
@@ -881,7 +881,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
         }
       }
       if (matchRR != foundRR || foundRR != vec->size()) {
-        L<<Logger::Error<<msgPrefix<<"Failed PreRequisites check (RRs differ), returning NXRRSet"<<endl;
+        g_log<<Logger::Error<<msgPrefix<<"Failed PreRequisites check (RRs differ), returning NXRRSet"<<endl;
         di.backend->abortTransaction();
         return RCode::NXRRSet;
       }
@@ -899,7 +899,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
       if (rr->d_place == DNSResourceRecord::AUTHORITY) {
         int res = checkUpdatePrescan(rr);
         if (res>0) {
-          L<<Logger::Error<<msgPrefix<<"Failed prescan check, returning "<<res<<endl;
+          g_log<<Logger::Error<<msgPrefix<<"Failed prescan check, returning "<<res<<endl;
           di.backend->abortTransaction();
           return res;
         }
@@ -931,7 +931,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
     }
     for (auto const &n : cn) {
       if (nocn.count(n) > 0) {
-        L<<Logger::Error<<msgPrefix<<"Refusing update, found CNAME and non-CNAME addition"<<endl;
+        g_log<<Logger::Error<<msgPrefix<<"Refusing update, found CNAME and non-CNAME addition"<<endl;
         di.backend->abortTransaction();
         return RCode::FormErr;
       }
@@ -944,10 +944,10 @@ int PacketHandler::processUpdate(DNSPacket *p) {
         /* see if it's permitted by policy */
         if (this->d_update_policy_lua != NULL) {
           if (this->d_update_policy_lua->updatePolicy(rr->d_name, QType(rr->d_type), di.zone, p) == false) {
-            L<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Not permitted by policy"<<endl;
+            g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Not permitted by policy"<<endl;
             continue;
           } else {
-            L<<Logger::Debug<<msgPrefix<<"Accepting update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Permitted by policy"<<endl;
+            g_log<<Logger::Debug<<msgPrefix<<"Accepting update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Permitted by policy"<<endl;
           }
         }
 
@@ -969,7 +969,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
       di.backend->lookup(QType(QType::ANY), rr->d_name);
       while (di.backend->get(rec)) {
         if (rec.qtype != QType::CNAME && rec.qtype != QType::RRSIG) {
-          L<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Data other than CNAME exists for the same name"<<endl;
+          g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Data other than CNAME exists for the same name"<<endl;
           di.backend->abortTransaction();
           return RCode::Refused;
         }
@@ -981,7 +981,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
       di.backend->lookup(QType(QType::CNAME), rr->d_name);
       while (di.backend->get(rec)) {
         if (rec.qtype == QType::CNAME && rr->d_type != QType::RRSIG) {
-          L<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": CNAME exists for the same name"<<endl;
+          g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": CNAME exists for the same name"<<endl;
           di.backend->abortTransaction();
           return RCode::Refused;
         }
@@ -1013,7 +1013,7 @@ int PacketHandler::processUpdate(DNSPacket *p) {
 
     if (changedRecords > 0) {
       if (!di.backend->commitTransaction()) {
-       L<<Logger::Error<<msgPrefix<<"Failed to commit updates!"<<endl;
+       g_log<<Logger::Error<<msgPrefix<<"Failed to commit updates!"<<endl;
         return RCode::ServFail;
       }
 
@@ -1033,36 +1033,36 @@ int PacketHandler::processUpdate(DNSPacket *p) {
         }
       }
 
-      L<<Logger::Info<<msgPrefix<<"Update completed, "<<changedRecords<<" changed records committed."<<endl;
+      g_log<<Logger::Info<<msgPrefix<<"Update completed, "<<changedRecords<<" changed records committed."<<endl;
     } else {
       //No change, no commit, we perform abort() because some backends might like this more.
-      L<<Logger::Info<<msgPrefix<<"Update completed, 0 changes, rolling back."<<endl;
+      g_log<<Logger::Info<<msgPrefix<<"Update completed, 0 changes, rolling back."<<endl;
       di.backend->abortTransaction();
     }
     return RCode::NoError; //rfc 2136 3.4.2.5
   }
   catch (SSqlException &e) {
-    L<<Logger::Error<<msgPrefix<<"Caught SSqlException: "<<e.txtReason()<<"; Sending ServFail!"<<endl;
+    g_log<<Logger::Error<<msgPrefix<<"Caught SSqlException: "<<e.txtReason()<<"; Sending ServFail!"<<endl;
     di.backend->abortTransaction();
     return RCode::ServFail;
   }
   catch (DBException &e) {
-    L<<Logger::Error<<msgPrefix<<"Caught DBException: "<<e.reason<<"; Sending ServFail!"<<endl;
+    g_log<<Logger::Error<<msgPrefix<<"Caught DBException: "<<e.reason<<"; Sending ServFail!"<<endl;
     di.backend->abortTransaction();
     return RCode::ServFail;
   }
   catch (PDNSException &e) {
-    L<<Logger::Error<<msgPrefix<<"Caught PDNSException: "<<e.reason<<"; Sending ServFail!"<<endl;
+    g_log<<Logger::Error<<msgPrefix<<"Caught PDNSException: "<<e.reason<<"; Sending ServFail!"<<endl;
     di.backend->abortTransaction();
     return RCode::ServFail;
   }
   catch(std::exception &e) {
-    L<<Logger::Error<<msgPrefix<<"Caught std:exception: "<<e.what()<<"; Sending ServFail!"<<endl;
+    g_log<<Logger::Error<<msgPrefix<<"Caught std:exception: "<<e.what()<<"; Sending ServFail!"<<endl;
     di.backend->abortTransaction();
     return RCode::ServFail;
   }
   catch (...) {
-    L<<Logger::Error<<msgPrefix<<"Caught unknown exception when performing update. Sending ServFail!"<<endl;
+    g_log<<Logger::Error<<msgPrefix<<"Caught unknown exception when performing update. Sending ServFail!"<<endl;
     di.backend->abortTransaction();
     return RCode::ServFail;
   }
@@ -1076,7 +1076,7 @@ void PacketHandler::increaseSerial(const string &msgPrefix, const DomainInfo *di
 
   uint32_t oldSerial = sd.serial;
   if (oldSerial == 0) { // using Autoserial, leave the serial alone.
-    L<<Logger::Notice<<msgPrefix<<"AutoSerial in use in domain \""<<di->zone.toLogString()<<"\", not updating SOA serial."<<endl;
+    g_log<<Logger::Notice<<msgPrefix<<"AutoSerial in use in domain \""<<di->zone.toLogString()<<"\", not updating SOA serial."<<endl;
     return;
   }
 
@@ -1090,7 +1090,7 @@ void PacketHandler::increaseSerial(const string &msgPrefix, const DomainInfo *di
       string soaEditSetting;
       d_dk.getSoaEdit(di->zone, soaEditSetting);
       if (soaEditSetting.empty()) {
-        L<<Logger::Error<<msgPrefix<<"Using "<<soaEdit2136<<" for SOA-EDIT-DNSUPDATE increase on DNS update, but SOA-EDIT is not set for domain \""<< di->zone.toLogString() <<"\". Using DEFAULT for SOA-EDIT-DNSUPDATE"<<endl;
+        g_log<<Logger::Error<<msgPrefix<<"Using "<<soaEdit2136<<" for SOA-EDIT-DNSUPDATE increase on DNS update, but SOA-EDIT is not set for domain \""<< di->zone.toLogString() <<"\". Using DEFAULT for SOA-EDIT-DNSUPDATE"<<endl;
         soaEdit2136 = "DEFAULT";
       } else
         soaEdit = soaEditSetting;
@@ -1100,7 +1100,7 @@ void PacketHandler::increaseSerial(const string &msgPrefix, const DomainInfo *di
   DNSResourceRecord rr;
   if (makeIncreasedSOARecord(sd, soaEdit2136, soaEdit, rr)) {
     di->backend->replaceRRSet(di->id, rr.qname, rr.qtype, vector<DNSResourceRecord>(1, rr));
-    L << Logger::Notice << msgPrefix << "Increasing SOA serial (" << oldSerial << " -> " << sd.serial << ")" << endl;
+    g_log << Logger::Notice << msgPrefix << "Increasing SOA serial (" << oldSerial << " -> " << sd.serial << ")" << endl;
 
     //Correct ordername + auth flag
     if (haveNSEC3) {
index 97706088a3e89af3560aa3567bf4555c7ff7c3f2..a135608f0ec9ca6bb69d723126fc4333c3ed77d2 100644 (file)
@@ -110,7 +110,7 @@ void RPZRecordToPolicy(const DNSRecord& dr, std::shared_ptr<DNSFilterEngine::Zon
     else if(!crcTarget.empty() && !crcTarget.isRoot() && crcTarget.getRawLabel(crcTarget.countLabels() - 1).compare(0, rpzPrefix.length(), rpzPrefix) == 0) {
       /* this is very likely an higher format number or a configuration error,
          let's just ignore it. */
-      L<<Logger::Info<<"Discarding unsupported RPZ entry "<<crcTarget<<" for "<<dr.d_name<<endl;
+      g_log<<Logger::Info<<"Discarding unsupported RPZ entry "<<crcTarget<<" for "<<dr.d_name<<endl;
       return;
     }
     else {
@@ -177,9 +177,9 @@ void RPZRecordToPolicy(const DNSRecord& dr, std::shared_ptr<DNSFilterEngine::Zon
 
 shared_ptr<SOARecordContent> loadRPZFromServer(const ComboAddress& master, const DNSName& zoneName, std::shared_ptr<DNSFilterEngine::Zone> zone, boost::optional<DNSFilterEngine::Policy> defpol, uint32_t maxTTL, const TSIGTriplet& tt, size_t maxReceivedBytes, const ComboAddress& localAddress, uint16_t axfrTimeout)
 {
-  L<<Logger::Warning<<"Loading RPZ zone '"<<zoneName<<"' from "<<master.toStringWithPort()<<endl;
+  g_log<<Logger::Warning<<"Loading RPZ zone '"<<zoneName<<"' from "<<master.toStringWithPort()<<endl;
   if(!tt.name.empty())
-    L<<Logger::Warning<<"With TSIG key '"<<tt.name<<"' of algorithm '"<<tt.algo<<"'"<<endl;
+    g_log<<Logger::Warning<<"With TSIG key '"<<tt.name<<"' of algorithm '"<<tt.algo<<"'"<<endl;
 
   ComboAddress local(localAddress);
   if (local == ComboAddress())
@@ -213,11 +213,11 @@ shared_ptr<SOARecordContent> loadRPZFromServer(const ComboAddress& master, const
       throw PDNSException("Total AXFR time exceeded!");
     }
     if(last != time(0)) {
-      L<<Logger::Info<<"Loaded & indexed "<<nrecords<<" policy records so far"<<endl;
+      g_log<<Logger::Info<<"Loaded & indexed "<<nrecords<<" policy records so far"<<endl;
       last=time(0);
     }
   }
-  L<<Logger::Info<<"Done: "<<nrecords<<" policy records active, SOA: "<<sr->getZoneRepresentation()<<endl;
+  g_log<<Logger::Info<<"Done: "<<nrecords<<" policy records active, SOA: "<<sr->getZoneRepresentation()<<endl;
   return sr;
 }
 
@@ -300,11 +300,11 @@ void RPZIXFRTracker(const ComboAddress& master, boost::optional<DNSFilterEngine:
       setRPZZoneNewState(polName, sr->d_st.serial, zone->size(), true);
     }
     catch(const std::exception& e) {
-      theL()<<Logger::Warning<<"Unable to load RPZ zone '"<<zoneName<<"' from '"<<master<<"': '"<<e.what()<<"'. (Will try again in "<<refresh<<" seconds...)"<<endl;
+      g_log<<Logger::Warning<<"Unable to load RPZ zone '"<<zoneName<<"' from '"<<master<<"': '"<<e.what()<<"'. (Will try again in "<<refresh<<" seconds...)"<<endl;
       incRPZFailedTransfers(polName);
     }
     catch(const PDNSException& e) {
-      theL()<<Logger::Warning<<"Unable to load RPZ zone '"<<zoneName<<"' from '"<<master<<"': '"<<e.reason<<"'. (Will try again in "<<refresh<<" seconds...)"<<endl;
+      g_log<<Logger::Warning<<"Unable to load RPZ zone '"<<zoneName<<"' from '"<<master<<"': '"<<e.reason<<"'. (Will try again in "<<refresh<<" seconds...)"<<endl;
       incRPZFailedTransfers(polName);
     }
 
@@ -323,7 +323,7 @@ void RPZIXFRTracker(const ComboAddress& master, boost::optional<DNSFilterEngine:
 
     sleep(refresh);
 
-    L<<Logger::Info<<"Getting IXFR deltas for "<<zoneName<<" from "<<master.toStringWithPort()<<", our serial: "<<getRR<SOARecordContent>(dr)->d_st.serial<<endl;
+    g_log<<Logger::Info<<"Getting IXFR deltas for "<<zoneName<<" from "<<master.toStringWithPort()<<", our serial: "<<getRR<SOARecordContent>(dr)->d_st.serial<<endl;
     vector<pair<vector<DNSRecord>, vector<DNSRecord> > > deltas;
 
     ComboAddress local(localAddress);
@@ -333,13 +333,13 @@ void RPZIXFRTracker(const ComboAddress& master, boost::optional<DNSFilterEngine:
     try {
       deltas = getIXFRDeltas(master, zoneName, dr, tt, &local, maxReceivedBytes);
     } catch(std::runtime_error& e ){
-      L<<Logger::Warning<<e.what()<<endl;
+      g_log<<Logger::Warning<<e.what()<<endl;
       incRPZFailedTransfers(polName);
       continue;
     }
     if(deltas.empty())
       continue;
-    L<<Logger::Info<<"Processing "<<deltas.size()<<" delta"<<addS(deltas)<<" for RPZ "<<zoneName<<endl;
+    g_log<<Logger::Info<<"Processing "<<deltas.size()<<" delta"<<addS(deltas)<<" for RPZ "<<zoneName<<endl;
 
     auto luaconfsLocal = g_luaconfs.getLocal();
     const std::shared_ptr<DNSFilterEngine::Zone> oldZone = luaconfsLocal->dfe.getZone(zoneIdx);
@@ -352,7 +352,7 @@ void RPZIXFRTracker(const ComboAddress& master, boost::optional<DNSFilterEngine:
       const auto& remove = delta.first;
       const auto& add = delta.second;
       if(remove.empty()) {
-        L<<Logger::Warning<<"IXFR update is a whole new zone"<<endl;
+        g_log<<Logger::Warning<<"IXFR update is a whole new zone"<<endl;
         newZone->clear();
         fullUpdate = true;
       }
@@ -365,11 +365,11 @@ void RPZIXFRTracker(const ComboAddress& master, boost::optional<DNSFilterEngine:
            //      cout<<"Got good removal of SOA serial "<<oldsr->d_st.serial<<endl;
          }
          else
-           L<<Logger::Error<<"GOT WRONG SOA SERIAL REMOVAL, SHOULD TRIGGER WHOLE RELOAD"<<endl;
+           g_log<<Logger::Error<<"GOT WRONG SOA SERIAL REMOVAL, SHOULD TRIGGER WHOLE RELOAD"<<endl;
        }
        else {
           totremove++;
-         L<<(g_logRPZChanges ? Logger::Info : Logger::Debug)<<"Had removal of "<<rr.d_name<<" from RPZ zone "<<zoneName<<endl;
+         g_log<<(g_logRPZChanges ? Logger::Info : Logger::Debug)<<"Had removal of "<<rr.d_name<<" from RPZ zone "<<zoneName<<endl;
          RPZRecordToPolicy(rr, newZone, false, defpol, maxTTL);
        }
       }
@@ -379,19 +379,19 @@ void RPZIXFRTracker(const ComboAddress& master, boost::optional<DNSFilterEngine:
           continue;
        if(rr.d_type == QType::SOA) {
          auto newsr = getRR<SOARecordContent>(rr);
-         //      L<<Logger::Info<<"New SOA serial for "<<zoneName<<": "<<newsr->d_st.serial<<endl;
+         //      g_log<<Logger::Info<<"New SOA serial for "<<zoneName<<": "<<newsr->d_st.serial<<endl;
          if (newsr) {
            sr = newsr;
          }
        }
        else {
           totadd++;
-         L<<(g_logRPZChanges ? Logger::Info : Logger::Debug)<<"Had addition of "<<rr.d_name<<" to RPZ zone "<<zoneName<<endl;
+         g_log<<(g_logRPZChanges ? Logger::Info : Logger::Debug)<<"Had addition of "<<rr.d_name<<" to RPZ zone "<<zoneName<<endl;
          RPZRecordToPolicy(rr, newZone, true, defpol, maxTTL);
        }
       }
     }
-    L<<Logger::Info<<"Had "<<totremove<<" RPZ removal"<<addS(totremove)<<", "<<totadd<<" addition"<<addS(totadd)<<" for "<<zoneName<<" New serial: "<<sr->d_st.serial<<endl;
+    g_log<<Logger::Info<<"Had "<<totremove<<" RPZ removal"<<addS(totremove)<<", "<<totadd<<" addition"<<addS(totadd)<<" for "<<zoneName<<" New serial: "<<sr->d_st.serial<<endl;
     newZone->setSerial(sr->d_st.serial);
     setRPZZoneNewState(polName, sr->d_st.serial, newZone->size(), fullUpdate);
 
index 646b296541ed0015d3e358dd6bc20300f01f0948..66656d5e2f13395b435066e4f55a9e5b36b817c4 100644 (file)
@@ -63,19 +63,19 @@ void doSecPoll(bool first)
   else {
     string pkgv(PACKAGEVERSION);
     if(pkgv.find("0.0.") != 0)
-      L<<Logger::Warning<<"Could not retrieve security status update for '" + pkgv + "' on '"+query+"', RCODE = "<< RCode::to_s(res)<<endl;
+      g_log<<Logger::Warning<<"Could not retrieve security status update for '" + pkgv + "' on '"+query+"', RCODE = "<< RCode::to_s(res)<<endl;
     else
-      L<<Logger::Warning<<"Not validating response for security status update, this is a non-release version."<<endl;
+      g_log<<Logger::Warning<<"Not validating response for security status update, this is a non-release version."<<endl;
   }
 
   if(security_status == 1 && first) {
-    L<<Logger::Warning << "Polled security status of version "<<PACKAGEVERSION<<" at startup, no known issues reported: " <<g_security_message<<endl;
+    g_log<<Logger::Warning << "Polled security status of version "<<PACKAGEVERSION<<" at startup, no known issues reported: " <<g_security_message<<endl;
   }
   if(security_status == 2) {
-    L<<Logger::Error<<"PowerDNS Security Update Recommended: "<<g_security_message<<endl;
+    g_log<<Logger::Error<<"PowerDNS Security Update Recommended: "<<g_security_message<<endl;
   }
   else if(security_status == 3) {
-    L<<Logger::Error<<"PowerDNS Security Update Mandatory: "<<g_security_message<<endl;
+    g_log<<Logger::Error<<"PowerDNS Security Update Mandatory: "<<g_security_message<<endl;
   }
 
   S.set("security-status",security_status);
index 3248b84657764b7d0e4a9ac1f463fddef00f9055..d88a7eb1a7307392d4e60fd534e32147093111a0 100644 (file)
@@ -55,7 +55,7 @@ void doSecPoll(time_t* last_secpoll)
   }
 
   if(state == Bogus) {
-    L<<Logger::Error<<"Could not retrieve security status update for '" +pkgv+ "' on '"<<query<<"', DNSSEC validation result was Bogus!"<<endl;
+    g_log<<Logger::Error<<"Could not retrieve security status update for '" +pkgv+ "' on '"<<query<<"', DNSSEC validation result was Bogus!"<<endl;
     if(g_security_status == 1) // If we were OK, go to unknown
       g_security_status = 0;
     return;
@@ -79,18 +79,18 @@ void doSecPoll(time_t* last_secpoll)
   }
   else {
     if(pkgv.find("0.0.") != 0)
-      L<<Logger::Warning<<"Could not retrieve security status update for '" +pkgv+ "' on '"<<query<<"', RCODE = "<< RCode::to_s(res)<<endl;
+      g_log<<Logger::Warning<<"Could not retrieve security status update for '" +pkgv+ "' on '"<<query<<"', RCODE = "<< RCode::to_s(res)<<endl;
     else
-      L<<Logger::Warning<<"Ignoring response for security status update, this is a non-release version."<<endl;
+      g_log<<Logger::Warning<<"Ignoring response for security status update, this is a non-release version."<<endl;
 
     if(g_security_status == 1) // it was ok, now it is unknown
       g_security_status = 0;
   }
 
   if(g_security_status == 2) {
-    L<<Logger::Error<<"PowerDNS Security Update Recommended: "<<g_security_message<<endl;
+    g_log<<Logger::Error<<"PowerDNS Security Update Recommended: "<<g_security_message<<endl;
   }
   else if(g_security_status == 3) {
-    L<<Logger::Error<<"PowerDNS Security Update Mandatory: "<<g_security_message<<endl;
+    g_log<<Logger::Error<<"PowerDNS Security Update Mandatory: "<<g_security_message<<endl;
   }
 }
index 06a036536bf073fe9f76e07b16d140e5e08b86ec..fc2c075ffff4c42347f4099e6c6a23b704ee2605 100644 (file)
@@ -66,7 +66,7 @@ uint32_t calculateEditSOA(uint32_t old_serial, const string& kind, const DNSName
     if (old_serial < inception)
       return inception;
   } else if(!kind.empty()) {
-    L<<Logger::Warning<<"SOA-EDIT type '"<<kind<<"' for zone "<<zonename<<" is unknown."<<endl;
+    g_log<<Logger::Warning<<"SOA-EDIT type '"<<kind<<"' for zone "<<zonename<<" is unknown."<<endl;
   }
   return old_serial;
 }
@@ -108,7 +108,7 @@ static uint32_t calculateIncreaseSOA(uint32_t old_serial, const string& increase
     }
     return new_serial;
   } else if(!increaseKind.empty()) {
-    L<<Logger::Warning<<"SOA-EDIT-API/DNSUPDATE type '"<<increaseKind<<"' for zone "<<zonename<<" is unknown."<<endl;
+    g_log<<Logger::Warning<<"SOA-EDIT-API/DNSUPDATE type '"<<increaseKind<<"' for zone "<<zonename<<" is unknown."<<endl;
   }
   return old_serial;
 }
index 2f8a2acd6737ee33e3caaa2b16ef5576231c3242..44e246cbe4c7bde0870f774333db92dcae032ab2 100644 (file)
@@ -51,7 +51,7 @@ try {
   return nullptr;
 }
 catch(...) {
-  L<<Logger::Error<<"Unknown exception in signing thread occurred"<<endl;
+  g_log<<Logger::Error<<"Unknown exception in signing thread occurred"<<endl;
   return nullptr;
 }
 
@@ -303,12 +303,12 @@ try
 }
 catch(const PDNSException& pe)
 {
-  L<<Logger::Error<<"Signing thread died because of PDNSException: "<<pe.reason<<endl;
+  g_log<<Logger::Error<<"Signing thread died because of PDNSException: "<<pe.reason<<endl;
   close(fd);
 }
 catch(const std::exception& e)
 {
-  L<<Logger::Error<<"Signing thread died because of std::exception: "<<e.what()<<endl;
+  g_log<<Logger::Error<<"Signing thread died because of std::exception: "<<e.what()<<endl;
   close(fd);
 }
 
index d70c34d891431191b39ab2481b4939f6d45262a1..144047ef520a205e3d3aa382003048a26060e411 100644 (file)
@@ -92,7 +92,7 @@ void CommunicatorClass::ixfrSuck(const DNSName &domain, const TSIGTriplet& tt, c
     DNSSECKeeper dk (&B); // reuse our UeberBackend copy for DNSSECKeeper
 
     if(!B.getDomainInfo(domain, di) || !di.backend || di.kind != DomainInfo::Slave) { // di.backend and B are mostly identical
-      L<<Logger::Error<<"Can't determine backend for domain '"<<domain<<"'"<<endl;
+      g_log<<Logger::Error<<"Can't determine backend for domain '"<<domain<<"'"<<endl;
       return;
     }
 
@@ -174,11 +174,11 @@ void CommunicatorClass::ixfrSuck(const DNSName &domain, const TSIGTriplet& tt, c
     }
   }
   catch(std::exception& p) {
-    L<<Logger::Error<<"Got exception during IXFR: "<<p.what()<<endl;
+    g_log<<Logger::Error<<"Got exception during IXFR: "<<p.what()<<endl;
     throw;
   }
   catch(PDNSException& p) {
-    L<<Logger::Error<<"Got exception during IXFR: "<<p.reason<<endl;
+    g_log<<Logger::Error<<"Got exception during IXFR: "<<p.reason<<endl;
     throw;
   }  
 }
@@ -244,7 +244,7 @@ static vector<DNSResourceRecord> doAxfr(const ComboAddress& raddr, const DNSName
   bool soa_received {false};
   while(retriever.getChunk(recs)) {
     if(first) {
-      L<<Logger::Error<<"AXFR started for '"<<domain<<"'"<<endl;
+      g_log<<Logger::Error<<"AXFR started for '"<<domain<<"'"<<endl;
       first=false;
     }
 
@@ -254,7 +254,7 @@ static vector<DNSResourceRecord> doAxfr(const ComboAddress& raddr, const DNSName
         continue;
 
       if(!i->qname.isPartOf(domain)) {
-        L<<Logger::Error<<"Remote "<<raddr.toStringWithPort()<<" tried to sneak in out-of-zone data '"<<i->qname<<"'|"<<i->qtype.getName()<<" during AXFR of zone '"<<domain<<"', ignoring"<<endl;
+        g_log<<Logger::Error<<"Remote "<<raddr.toStringWithPort()<<" tried to sneak in out-of-zone data '"<<i->qname<<"'|"<<i->qtype.getName()<<" during AXFR of zone '"<<domain<<"', ignoring"<<endl;
         continue;
       }
 
@@ -265,7 +265,7 @@ static vector<DNSResourceRecord> doAxfr(const ComboAddress& raddr, const DNSName
 
       for(DNSResourceRecord& rr :  out) {
         if(!rr.qname.isPartOf(domain)) {
-          L<<Logger::Error<<"Lua axfrfilter() filter tried to sneak in out-of-zone data '"<<i->qname<<"'|"<<i->qtype.getName()<<" during AXFR of zone '"<<domain<<"', ignoring"<<endl;
+          g_log<<Logger::Error<<"Lua axfrfilter() filter tried to sneak in out-of-zone data '"<<i->qname<<"'|"<<i->qtype.getName()<<" during AXFR of zone '"<<domain<<"', ignoring"<<endl;
           continue;
         }
         if(!processRecordForZS(domain, firstNSEC3, rr, zs))
@@ -299,7 +299,7 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
   }
   RemoveSentinel rs(domain, this); // this removes us from d_inprogress when we go out of scope
 
-  L<<Logger::Error<<"Initiating transfer of '"<<domain<<"' from remote '"<<remote<<"'"<<endl;
+  g_log<<Logger::Error<<"Initiating transfer of '"<<domain<<"' from remote '"<<remote<<"'"<<endl;
   UeberBackend B; // fresh UeberBackend
 
   DomainInfo di;
@@ -309,7 +309,7 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
     DNSSECKeeper dk (&B); // reuse our UeberBackend copy for DNSSECKeeper
 
     if(!B.getDomainInfo(domain, di) || !di.backend || di.kind != DomainInfo::Slave) { // di.backend and B are mostly identical
-      L<<Logger::Error<<"Can't determine backend for domain '"<<domain<<"'"<<endl;
+      g_log<<Logger::Error<<"Can't determine backend for domain '"<<domain<<"'"<<endl;
       return;
     }
     ZoneStatus zs;
@@ -320,11 +320,11 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
       string tsigsecret64;
       if(B.getTSIGKey(tt.name, &tt.algo, &tsigsecret64)) {
         if(B64Decode(tsigsecret64, tt.secret)) {
-          L<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<tt.name<<"' for domain '"<<domain<<"' not found"<<endl;
+          g_log<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<tt.name<<"' for domain '"<<domain<<"' not found"<<endl;
           return;
         }
       } else {
-        L<<Logger::Error<<"TSIG key '"<<tt.name<<"' for domain '"<<domain<<"' not found"<<endl;
+        g_log<<Logger::Error<<"TSIG key '"<<tt.name<<"' for domain '"<<domain<<"' not found"<<endl;
         return;
       }
     }
@@ -344,10 +344,10 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
       try {
         pdl.reset(new AuthLua4());
         pdl->loadFile(script);
-        L<<Logger::Info<<"Loaded Lua script '"<<script<<"' to edit the incoming AXFR of '"<<domain<<"'"<<endl;
+        g_log<<Logger::Info<<"Loaded Lua script '"<<script<<"' to edit the incoming AXFR of '"<<domain<<"'"<<endl;
       }
       catch(std::exception& e) {
-        L<<Logger::Error<<"Failed to load Lua editing script '"<<script<<"' for incoming AXFR of '"<<domain<<"': "<<e.what()<<endl;
+        g_log<<Logger::Error<<"Failed to load Lua editing script '"<<script<<"' for incoming AXFR of '"<<domain<<"': "<<e.what()<<endl;
         return;
       }
     }
@@ -358,10 +358,10 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
     if(B.getDomainMetadata(domain, "AXFR-SOURCE", localaddr) && !localaddr.empty()) {
       try {
         laddr = ComboAddress(localaddr[0]);
-        L<<Logger::Info<<"AXFR source for domain '"<<domain<<"' set to "<<localaddr[0]<<endl;
+        g_log<<Logger::Info<<"AXFR source for domain '"<<domain<<"' set to "<<localaddr[0]<<endl;
       }
       catch(std::exception& e) {
-        L<<Logger::Error<<"Failed to load AXFR source '"<<localaddr[0]<<"' for incoming AXFR of '"<<domain<<"': "<<e.what()<<endl;
+        g_log<<Logger::Error<<"Failed to load AXFR source '"<<localaddr[0]<<"' for incoming AXFR of '"<<domain<<"': "<<e.what()<<endl;
         return;
       }
     } else {
@@ -371,7 +371,7 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
         laddr = ComboAddress(::arg()["query-local-address6"]);
       } else {
         bool isv6 = raddr.sin4.sin_family == AF_INET6;
-        L<<Logger::Error<<"Unable to AXFR, destination address is IPv" << (isv6 ? "6" : "4") << ", but query-local-address"<< (isv6 ? "6" : "") << " is unset!"<<endl;
+        g_log<<Logger::Error<<"Unable to AXFR, destination address is IPv" << (isv6 ? "6" : "4") << ", but query-local-address"<< (isv6 ? "6" : "") << " is unset!"<<endl;
         return;
       }
     }
@@ -398,10 +398,10 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
       B.getDomainMetadata(domain, "IXFR", meta);
       if(!meta.empty() && meta[0]=="1") {
         vector<DNSRecord> axfr;
-        L<<Logger::Warning<<"Starting IXFR of '"<<domain<<"' from remote "<<raddr.toStringWithPort()<<endl;
+        g_log<<Logger::Warning<<"Starting IXFR of '"<<domain<<"' from remote "<<raddr.toStringWithPort()<<endl;
         ixfrSuck(domain, tt, laddr, raddr, pdl, zs, &axfr);
         if(!axfr.empty()) {
-          L<<Logger::Warning<<"IXFR of '"<<domain<<"' from remote '"<<raddr.toStringWithPort()<<"' turned into an AXFR"<<endl;
+          g_log<<Logger::Warning<<"IXFR of '"<<domain<<"' from remote '"<<raddr.toStringWithPort()<<"' turned into an AXFR"<<endl;
           bool firstNSEC3=true;
           rrs.reserve(axfr.size());
           for(const auto& dr : axfr) {
@@ -418,7 +418,7 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
           }
         }
         else {
-          L<<Logger::Warning<<"Done with IXFR of '"<<domain<<"' from remote '"<<remote<<"', got "<<zs.numDeltas<<" delta"<<addS(zs.numDeltas)<<", serial now "<<zs.soa_serial<<endl;
+          g_log<<Logger::Warning<<"Done with IXFR of '"<<domain<<"' from remote '"<<remote<<"', got "<<zs.numDeltas<<" delta"<<addS(zs.numDeltas)<<", serial now "<<zs.soa_serial<<endl;
           purgeAuthCaches(domain.toString()+"$");
           return;
         }
@@ -426,9 +426,9 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
     }
 
     if(rrs.empty()) {
-      L<<Logger::Warning<<"Starting AXFR of '"<<domain<<"' from remote "<<raddr.toStringWithPort()<<endl;
+      g_log<<Logger::Warning<<"Starting AXFR of '"<<domain<<"' from remote "<<raddr.toStringWithPort()<<endl;
       rrs = doAxfr(raddr, domain, tt, laddr, pdl, zs);
-      L<<Logger::Warning<<"AXFR of '"<<domain<<"' from remote "<<raddr.toStringWithPort()<<" done"<<endl;
+      g_log<<Logger::Warning<<"AXFR of '"<<domain<<"' from remote "<<raddr.toStringWithPort()<<" done"<<endl;
     }
  
     if(zs.isNSEC3) {
@@ -448,16 +448,16 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
 
     if(zs.isDnssecZone) {
       if(!zs.isNSEC3)
-        L<<Logger::Info<<"Adding NSEC ordering information"<<endl;
+        g_log<<Logger::Info<<"Adding NSEC ordering information"<<endl;
       else if(!zs.isNarrow)
-        L<<Logger::Info<<"Adding NSEC3 hashed ordering information for '"<<domain<<"'"<<endl;
+        g_log<<Logger::Info<<"Adding NSEC3 hashed ordering information for '"<<domain<<"'"<<endl;
       else
-        L<<Logger::Info<<"Erasing NSEC3 ordering since we are narrow, only setting 'auth' fields"<<endl;
+        g_log<<Logger::Info<<"Erasing NSEC3 ordering since we are narrow, only setting 'auth' fields"<<endl;
     }
 
 
     transaction=di.backend->startTransaction(domain, zs.domain_id);
-    L<<Logger::Error<<"Backend transaction started for '"<<domain<<"' storage"<<endl;
+    g_log<<Logger::Error<<"Backend transaction started for '"<<domain<<"' storage"<<endl;
 
     // update the presigned flag and NSEC3PARAM
     if (zs.isDnssecZone) {
@@ -544,7 +544,7 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
         }
 
         if(nonterm.size() > maxent) {
-          L<<Logger::Error<<"AXFR zone "<<domain<<" has too many empty non terminals."<<endl;
+          g_log<<Logger::Error<<"AXFR zone "<<domain<<" has too many empty non terminals."<<endl;
           nonterm.clear();
           doent=false;
         }
@@ -589,42 +589,42 @@ void CommunicatorClass::suck(const DNSName &domain, const string &remote)
     purgeAuthCaches(domain.toString()+"$");
 
 
-    L<<Logger::Error<<"AXFR done for '"<<domain<<"', zone committed with serial number "<<zs.soa_serial<<endl;
+    g_log<<Logger::Error<<"AXFR done for '"<<domain<<"', zone committed with serial number "<<zs.soa_serial<<endl;
     if(::arg().mustDo("slave-renotify"))
       notifyDomain(domain);
   }
   catch(DBException &re) {
-    L<<Logger::Error<<"Unable to feed record during incoming AXFR of '" << domain<<"': "<<re.reason<<endl;
+    g_log<<Logger::Error<<"Unable to feed record during incoming AXFR of '" << domain<<"': "<<re.reason<<endl;
     if(di.backend && transaction) {
-      L<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
+      g_log<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
       di.backend->abortTransaction();
     }
   }
   catch(MOADNSException &re) {
-    L<<Logger::Error<<"Unable to parse record during incoming AXFR of '"<<domain<<"' (MOADNSException): "<<re.what()<<endl;
+    g_log<<Logger::Error<<"Unable to parse record during incoming AXFR of '"<<domain<<"' (MOADNSException): "<<re.what()<<endl;
     if(di.backend && transaction) {
-      L<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
+      g_log<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
       di.backend->abortTransaction();
     }
   }
   catch(std::exception &re) {
-    L<<Logger::Error<<"Unable to parse record during incoming AXFR of '"<<domain<<"' (std::exception): "<<re.what()<<endl;
+    g_log<<Logger::Error<<"Unable to parse record during incoming AXFR of '"<<domain<<"' (std::exception): "<<re.what()<<endl;
     if(di.backend && transaction) {
-      L<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
+      g_log<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
       di.backend->abortTransaction();
     }
   }
   catch(ResolverException &re) {
-    L<<Logger::Error<<"Unable to AXFR zone '"<<domain<<"' from remote '"<<remote<<"' (resolver): "<<re.reason<<endl;
+    g_log<<Logger::Error<<"Unable to AXFR zone '"<<domain<<"' from remote '"<<remote<<"' (resolver): "<<re.reason<<endl;
     if(di.backend && transaction) {
-      L<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
+      g_log<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
       di.backend->abortTransaction();
     }
   }
   catch(PDNSException &ae) {
-    L<<Logger::Error<<"Unable to AXFR zone '"<<domain<<"' from remote '"<<remote<<"' (PDNSException): "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"Unable to AXFR zone '"<<domain<<"' from remote '"<<remote<<"' (PDNSException): "<<ae.reason<<endl;
     if(di.backend && transaction) {
-      L<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
+      g_log<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
       di.backend->abortTransaction();
     }
   }
@@ -794,11 +794,11 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
       if(dk.getTSIGForAccess(di.zone, sr.master, &dni.tsigkeyname)) {
         string secret64;
         if(!B->getTSIGKey(dni.tsigkeyname, &dni.tsigalgname, &secret64)) {
-          L<<Logger::Error<<"TSIG key '"<<dni.tsigkeyname<<"' for domain '"<<di.zone<<"' not found, can not AXFR."<<endl;
+          g_log<<Logger::Error<<"TSIG key '"<<dni.tsigkeyname<<"' for domain '"<<di.zone<<"' not found, can not AXFR."<<endl;
           continue;
         }
         if (B64Decode(secret64, dni.tsigsecret) == -1) {
-          L<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<dni.tsigkeyname<<"' for domain '"<<di.zone<<"', can not AXFR."<<endl;
+          g_log<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<dni.tsigkeyname<<"' for domain '"<<di.zone<<"', can not AXFR."<<endl;
           continue;
         }
       }
@@ -808,10 +808,10 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
       if(B->getDomainMetadata(di.zone, "AXFR-SOURCE", localaddr) && !localaddr.empty()) {
         try {
           dni.localaddr = ComboAddress(localaddr[0]);
-          L<<Logger::Info<<"Freshness check source (AXFR-SOURCE) for domain '"<<di.zone<<"' set to "<<localaddr[0]<<endl;
+          g_log<<Logger::Info<<"Freshness check source (AXFR-SOURCE) for domain '"<<di.zone<<"' set to "<<localaddr[0]<<endl;
         }
         catch(std::exception& e) {
-          L<<Logger::Error<<"Failed to load freshness check source '"<<localaddr[0]<<"' for '"<<di.zone<<"': "<<e.what()<<endl;
+          g_log<<Logger::Error<<"Failed to load freshness check source '"<<localaddr[0]<<"' for '"<<di.zone<<"': "<<e.what()<<endl;
           return;
         }
       } else {
@@ -825,14 +825,14 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
   {
     if(d_slaveschanged) {
       Lock l(&d_lock);
-      L<<Logger::Warning<<"No new unfresh slave domains, "<<d_suckdomains.size()<<" queued for AXFR already, "<<d_inprogress.size()<<" in progress"<<endl;
+      g_log<<Logger::Warning<<"No new unfresh slave domains, "<<d_suckdomains.size()<<" queued for AXFR already, "<<d_inprogress.size()<<" in progress"<<endl;
     }
     d_slaveschanged = !rdomains.empty();
     return;
   }
   else {
     Lock l(&d_lock);
-    L<<Logger::Warning<<sdomains.size()<<" slave domain"<<(sdomains.size()>1 ? "s" : "")<<" need"<<
+    g_log<<Logger::Warning<<sdomains.size()<<" slave domain"<<(sdomains.size()>1 ? "s" : "")<<" need"<<
       (sdomains.size()>1 ? "" : "s")<<
       " checking, "<<d_suckdomains.size()<<" queued for AXFR"<<endl;
   }
@@ -849,13 +849,13 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
       break;
     }
     catch(std::exception& e) {
-      L<<Logger::Error<<"While checking domain freshness: " << e.what()<<endl;
+      g_log<<Logger::Error<<"While checking domain freshness: " << e.what()<<endl;
     }
     catch(PDNSException &re) {
-      L<<Logger::Error<<"While checking domain freshness: " << re.reason<<endl;
+      g_log<<Logger::Error<<"While checking domain freshness: " << re.reason<<endl;
     }
   }
-  L<<Logger::Warning<<"Received serial number updates for "<<ssr.d_freshness.size()<<" zone"<<addS(ssr.d_freshness.size())<<", had "<<ifl.getTimeouts()<<" timeout"<<addS(ifl.getTimeouts())<<endl;
+  g_log<<Logger::Warning<<"Received serial number updates for "<<ssr.d_freshness.size()<<" zone"<<addS(ssr.d_freshness.size())<<", had "<<ifl.getTimeouts()<<" timeout"<<addS(ifl.getTimeouts())<<endl;
 
   typedef DomainNotificationInfo val_t;
   time_t now = time(0);
@@ -866,7 +866,7 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
     // Please do not overwrite received DI just to make sure it exists in backend.
     if(!di.backend) {
       if (!B->getDomainInfo(di.zone, tempdi)) {
-        L<<Logger::Warning<<"Ignore domain "<< di.zone<<" since it has been removed from our backend"<<endl;
+        g_log<<Logger::Warning<<"Ignore domain "<< di.zone<<" since it has been removed from our backend"<<endl;
         continue;
       }
       // Backend for di still doesn't exist and this might cause us to
@@ -882,7 +882,7 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
       time_t nextCheck = now + std::min(newCount * d_tickinterval, (uint64_t)::arg().asNum("soa-retry-default"));
       d_failedSlaveRefresh[di.zone] = {newCount, nextCheck};
       if (newCount == 1 || newCount % 10 == 0)
-        L<<Logger::Warning<<"Unable to retrieve SOA for "<<di.zone<<", this was the "<<(newCount == 1 ? "first" : std::to_string(newCount) + "th")<<" time."<<endl;
+        g_log<<Logger::Warning<<"Unable to retrieve SOA for "<<di.zone<<", this was the "<<(newCount == 1 ? "first" : std::to_string(newCount) + "th")<<" time."<<endl;
       continue;
     }
 
@@ -893,7 +893,7 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
     uint32_t theirserial = ssr.d_freshness[di.id].theirSerial, ourserial = di.serial;
 
     if(rfc1982LessThan(theirserial, ourserial) && ourserial != 0 && !::arg().mustDo("axfr-lower-serial"))  {
-      L<<Logger::Error<<"Domain '"<<di.zone<<"' more recent than master, our serial " << ourserial << " > their serial "<< theirserial << endl;
+      g_log<<Logger::Error<<"Domain '"<<di.zone<<"' more recent than master, our serial " << ourserial << " > their serial "<< theirserial << endl;
       di.backend->setFresh(di.id);
     }
     else if(theirserial == ourserial) {
@@ -910,32 +910,32 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
         }
       }
       if(! maxInception && ! ssr.d_freshness[di.id].theirInception) {
-        L<<Logger::Info<<"Domain '"<< di.zone<<"' is fresh (no DNSSEC)"<<endl;
+        g_log<<Logger::Info<<"Domain '"<< di.zone<<"' is fresh (no DNSSEC)"<<endl;
         di.backend->setFresh(di.id);
       }
       else if(maxInception == ssr.d_freshness[di.id].theirInception && maxExpire == ssr.d_freshness[di.id].theirExpire) {
-        L<<Logger::Info<<"Domain '"<< di.zone<<"' is fresh and SOA RRSIGs match"<<endl;
+        g_log<<Logger::Info<<"Domain '"<< di.zone<<"' is fresh and SOA RRSIGs match"<<endl;
         di.backend->setFresh(di.id);
       }
       else if(maxExpire >= now && ! ssr.d_freshness[di.id].theirInception ) {
-        L<<Logger::Info<<"Domain '"<< di.zone<<"' is fresh, master is no longer signed but (some) signatures are still vallid"<<endl;
+        g_log<<Logger::Info<<"Domain '"<< di.zone<<"' is fresh, master is no longer signed but (some) signatures are still vallid"<<endl;
         di.backend->setFresh(di.id);
       }
       else if(maxInception && ! ssr.d_freshness[di.id].theirInception ) {
-        L<<Logger::Warning<<"Domain '"<< di.zone<<"' is stale, master is no longer signed and all signatures have expired"<<endl;
+        g_log<<Logger::Warning<<"Domain '"<< di.zone<<"' is stale, master is no longer signed and all signatures have expired"<<endl;
         addSuckRequest(di.zone, *di.masters.begin());
       }
       else if(dk.doesDNSSEC() && ! maxInception && ssr.d_freshness[di.id].theirInception) {
-        L<<Logger::Warning<<"Domain '"<< di.zone<<"' is stale, master has signed"<<endl;
+        g_log<<Logger::Warning<<"Domain '"<< di.zone<<"' is stale, master has signed"<<endl;
         addSuckRequest(di.zone, *di.masters.begin());
       }
       else {
-        L<<Logger::Warning<<"Domain '"<< di.zone<<"' is fresh, but RRSIGs differ, so DNSSEC is stale"<<endl;
+        g_log<<Logger::Warning<<"Domain '"<< di.zone<<"' is fresh, but RRSIGs differ, so DNSSEC is stale"<<endl;
         addSuckRequest(di.zone, *di.masters.begin());
       }
     }
     else {
-      L<<Logger::Warning<<"Domain '"<< di.zone<<"' is stale, master serial "<<theirserial<<", our serial "<< ourserial <<endl;
+      g_log<<Logger::Warning<<"Domain '"<< di.zone<<"' is stale, master serial "<<theirserial<<", our serial "<< ourserial <<endl;
       addSuckRequest(di.zone, *di.masters.begin());
     }
   }
index 037aa259a75acb3fd1745db9d02ea67987deae25..4e29436bbf2611a1ba79025bdfd57d0e38bea070 100644 (file)
@@ -78,7 +78,7 @@ public:
   SSqlStatement* execute() {
     prepareStatement();
     if (d_dolog)
-      L<<Logger::Warning<< "Query: " << d_query << endl;
+      g_log<<Logger::Warning<< "Query: " << d_query << endl;
     int attempts = d_db->inTransaction(); // try only once
     while(attempts < 2 && (d_rc = sqlite3_step(d_stmt)) == SQLITE_BUSY) attempts++;
 
@@ -159,7 +159,7 @@ private:
       throw SSqlException(string("Unable to compile SQLite statement : '")+d_query+"': "+sqlite3_errmsg(d_db->db()));
     }
     if (pTail && strlen(pTail)>0)
-      L<<Logger::Warning<<"Sqlite3 command partially processed. Unprocessed part: "<<pTail<<endl;
+      g_log<<Logger::Warning<<"Sqlite3 command partially processed. Unprocessed part: "<<pTail<<endl;
     d_prepared = true;
   }
 
index 75783cc38a6f994ad1845a7b24fcca2cd0756842..1006618bad127f47965e8daf85443347a443908c 100644 (file)
@@ -35,7 +35,7 @@ static time_t s_localResolvConfLastCheck = 0;
 bool resolversDefined()
 {
   if (s_resolversForStub.empty()) {
-    L<<Logger::Warning<<"No upstream resolvers configured, stub resolving (including secpoll and ALIAS) impossible."<<endl;
+    g_log<<Logger::Warning<<"No upstream resolvers configured, stub resolving (including secpoll and ALIAS) impossible."<<endl;
     return false;
   }
   return true;
@@ -131,7 +131,7 @@ int stubDoResolve(const DNSName& qname, uint16_t qtype, vector<DNSZoneRecord>& r
   for (const auto& server : s_resolversForStub) {
     msg += server.toString() + ", ";
   }
-  L<<Logger::Debug<<msg.substr(0, msg.length() - 2)<<endl;
+  g_log<<Logger::Debug<<msg.substr(0, msg.length() - 2)<<endl;
 
   for(const ComboAddress& dest :  s_resolversForStub) {
     Socket sock(dest.sin4.sin_family, SOCK_DGRAM);
@@ -167,7 +167,7 @@ int stubDoResolve(const DNSName& qname, uint16_t qtype, vector<DNSZoneRecord>& r
         ret.push_back(zrr);
       }
     }
-    L<<Logger::Debug<<"Question got answered by "<<dest.toString()<<endl;
+    g_log<<Logger::Debug<<"Question got answered by "<<dest.toString()<<endl;
     return mdp.d_header.rcode;
   }
   return RCode::ServFail;
index 16755ec9368954f5c93d28485614ae6bc9587429..e4357201ad40691827ed12393f48d8f145e1958a 100644 (file)
@@ -77,7 +77,7 @@ bool SyncRes::s_nopacketcache;
 bool SyncRes::s_rootNXTrust;
 bool SyncRes::s_noEDNS;
 
-#define LOG(x) if(d_lm == Log) { L <<Logger::Warning << x; } else if(d_lm == Store) { d_trace << x; }
+#define LOG(x) if(d_lm == Log) { g_log <<Logger::Warning << x; } else if(d_lm == Store) { d_trace << x; }
 
 static void accountAuthLatency(int usec, int family)
 {
@@ -2890,23 +2890,23 @@ int SyncRes::getRootNS(struct timeval now, asyncresolve_t asyncCallback) {
     return res;
   }
   catch(const PDNSException& e) {
-    L<<Logger::Error<<"Failed to update . records, got an exception: "<<e.reason<<endl;
+    g_log<<Logger::Error<<"Failed to update . records, got an exception: "<<e.reason<<endl;
   }
   catch(const ImmediateServFailException& e) {
-    L<<Logger::Error<<"Failed to update . records, got an exception: "<<e.reason<<endl;
+    g_log<<Logger::Error<<"Failed to update . records, got an exception: "<<e.reason<<endl;
   }
   catch(const std::exception& e) {
-    L<<Logger::Error<<"Failed to update . records, got an exception: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Failed to update . records, got an exception: "<<e.what()<<endl;
   }
   catch(...) {
-    L<<Logger::Error<<"Failed to update . records, got an exception"<<endl;
+    g_log<<Logger::Error<<"Failed to update . records, got an exception"<<endl;
   }
 
   if(!res) {
-    L<<Logger::Notice<<"Refreshed . records"<<endl;
+    g_log<<Logger::Notice<<"Refreshed . records"<<endl;
   }
   else
-    L<<Logger::Error<<"Failed to update . records, RCODE="<<res<<endl;
+    g_log<<Logger::Error<<"Failed to update . records, RCODE="<<res<<endl;
 
   return res;
 }
index 49d2b30d87a9726c322de868fabe21d2ccfc1f05..409b095588d7a2403b53d722f088a889c754e3ca 100644 (file)
@@ -78,13 +78,13 @@ std::map<ComboAddress,size_t,ComboAddress::addressOnlyLessThan> TCPNameserver::s
 
 void TCPNameserver::go()
 {
-  L<<Logger::Error<<"Creating backend connection for TCP"<<endl;
+  g_log<<Logger::Error<<"Creating backend connection for TCP"<<endl;
   s_P=0;
   try {
     s_P=new PacketHandler;
   }
   catch(PDNSException &ae) {
-    L<<Logger::Error<<"TCP server is unable to launch backends - will try again when questions come in: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"TCP server is unable to launch backends - will try again when questions come in: "<<ae.reason<<endl;
   }
   pthread_create(&d_tid, 0, launcher, static_cast<void *>(this));
 }
@@ -265,13 +265,13 @@ void *TCPNameserver::doConnection(void *data)
 
   pthread_detach(pthread_self());
   if(getpeername(fd, (struct sockaddr *)&remote, &remotelen) < 0) {
-    L<<Logger::Warning<<"Received question from socket which had no remote address, dropping ("<<stringerror()<<")"<<endl;
+    g_log<<Logger::Warning<<"Received question from socket which had no remote address, dropping ("<<stringerror()<<")"<<endl;
     d_connectionroom_sem->post();
     try {
       closesocket(fd);
     }
     catch(const PDNSException& e) {
-      L<<Logger::Error<<"Error closing TCP socket: "<<e.reason<<endl;
+      g_log<<Logger::Error<<"Error closing TCP socket: "<<e.reason<<endl;
     }
     return 0;
   }
@@ -281,17 +281,17 @@ void *TCPNameserver::doConnection(void *data)
     int mesgsize=65535;
     scoped_array<char> mesg(new char[mesgsize]);
     
-    DLOG(L<<"TCP Connection accepted on fd "<<fd<<endl);
+    DLOG(g_log<<"TCP Connection accepted on fd "<<fd<<endl);
     bool logDNSQueries= ::arg().mustDo("log-dns-queries");
     for(;;) {
       unsigned int remainingTime = 0;
       transactions++;
       if (d_maxTransactionsPerConn && transactions > d_maxTransactionsPerConn) {
-        L << Logger::Notice<<"TCP Remote "<< remote <<" exceeded the number of transactions per connection, dropping.";
+        g_log << Logger::Notice<<"TCP Remote "<< remote <<" exceeded the number of transactions per connection, dropping.";
         break;
       }
       if (maxConnectionDurationReached(d_maxConnectionDuration, start, remainingTime)) {
-        L << Logger::Notice<<"TCP Remote "<< remote <<" exceeded the maximum TCP connection duration, dropping.";
+        g_log << Logger::Notice<<"TCP Remote "<< remote <<" exceeded the maximum TCP connection duration, dropping.";
         break;
       }
 
@@ -309,12 +309,12 @@ void *TCPNameserver::doConnection(void *data)
       // do not remove this check as it will catch if someone
       // decreases the mesg buffer size for some reason. 
       if(pktlen > mesgsize) {
-        L<<Logger::Warning<<"Received an overly large question from "<<remote.toString()<<", dropping"<<endl;
+        g_log<<Logger::Warning<<"Received an overly large question from "<<remote.toString()<<", dropping"<<endl;
         break;
       }
       
       if (maxConnectionDurationReached(d_maxConnectionDuration, start, remainingTime)) {
-        L << Logger::Notice<<"TCP Remote "<< remote <<" exceeded the maximum TCP connection duration, dropping.";
+        g_log << Logger::Notice<<"TCP Remote "<< remote <<" exceeded the maximum TCP connection duration, dropping.";
         break;
       }
 
@@ -352,14 +352,14 @@ void *TCPNameserver::doConnection(void *data)
           remote_text = packet->getRemote().toString() + "<-" + packet->getRealRemote().toString();
         else
           remote_text = packet->getRemote().toString();
-        L << Logger::Notice<<"TCP Remote "<< remote_text <<" wants '" << packet->qdomain<<"|"<<packet->qtype.getName() <<
+        g_log << Logger::Notice<<"TCP Remote "<< remote_text <<" wants '" << packet->qdomain<<"|"<<packet->qtype.getName() <<
         "', do = " <<packet->d_dnssecOk <<", bufsize = "<< packet->getMaxReplyLen()<<": ";
       }
 
 
       if(packet->couldBeCached() && PC.get(packet.get(), cached.get())) { // short circuit - does the PacketCache recognize this question?
         if(logDNSQueries)
-          L<<"packetcache HIT"<<endl;
+          g_log<<"packetcache HIT"<<endl;
         cached->setRemote(&packet->d_remote);
         cached->d.id=packet->d.id;
         cached->d.rd=packet->d.rd; // copy in recursion desired bit 
@@ -369,11 +369,11 @@ void *TCPNameserver::doConnection(void *data)
         continue;
       }
       if(logDNSQueries)
-          L<<"packetcache MISS"<<endl;  
+          g_log<<"packetcache MISS"<<endl;  
       {
         Lock l(&s_plock);
         if(!s_P) {
-          L<<Logger::Error<<"TCP server is without backend connections, launching"<<endl;
+          g_log<<Logger::Error<<"TCP server is without backend connections, launching"<<endl;
           s_P=new PacketHandler;
         }
 
@@ -390,18 +390,18 @@ void *TCPNameserver::doConnection(void *data)
     Lock l(&s_plock);
     delete s_P;
     s_P = 0; // on next call, backend will be recycled
-    L<<Logger::Error<<"TCP nameserver had error, cycling backend: "<<ae.reason<<endl;
+    g_log<<Logger::Error<<"TCP nameserver had error, cycling backend: "<<ae.reason<<endl;
   }
   catch(NetworkError &e) {
-    L<<Logger::Info<<"TCP Connection Thread died because of network error: "<<e.what()<<endl;
+    g_log<<Logger::Info<<"TCP Connection Thread died because of network error: "<<e.what()<<endl;
   }
 
   catch(std::exception &e) {
-    L<<Logger::Error<<"TCP Connection Thread died because of STL error: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"TCP Connection Thread died because of STL error: "<<e.what()<<endl;
   }
   catch( ... )
   {
-    L << Logger::Error << "TCP Connection Thread caught unknown exception." << endl;
+    g_log << Logger::Error << "TCP Connection Thread caught unknown exception." << endl;
   }
   d_connectionroom_sem->post();
 
@@ -409,7 +409,7 @@ void *TCPNameserver::doConnection(void *data)
     closesocket(fd);
   }
   catch(const PDNSException& e) {
-    L<<Logger::Error<<"Error closing TCP socket: "<<e.reason<<endl;
+    g_log<<Logger::Error<<"Error closing TCP socket: "<<e.reason<<endl;
   }
   decrementClientCount(remote);
 
@@ -434,7 +434,7 @@ bool TCPNameserver::canDoAXFR(shared_ptr<DNSPacket> q)
       if (q->d_tsig_algo == TSIG_GSS) {
         GssContext gssctx(keyname);
         if (!gssctx.getPeerPrincipal(q->d_peer_principal)) {
-          L<<Logger::Warning<<"Failed to extract peer principal from GSS context with keyname '"<<keyname<<"'"<<endl;
+          g_log<<Logger::Warning<<"Failed to extract peer principal from GSS context with keyname '"<<keyname<<"'"<<endl;
         }
       }
     }
@@ -446,27 +446,27 @@ bool TCPNameserver::canDoAXFR(shared_ptr<DNSPacket> q)
       s_P->getBackend()->getDomainMetadata(q->qdomain, "GSS-ALLOW-AXFR-PRINCIPAL", princs);
       for(const std::string& princ :  princs) {
         if (q->d_peer_principal == princ) {
-          L<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: TSIG signed request with authorized principal '"<<q->d_peer_principal<<"' and algorithm 'gss-tsig'"<<endl;
+          g_log<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: TSIG signed request with authorized principal '"<<q->d_peer_principal<<"' and algorithm 'gss-tsig'"<<endl;
           return true;
         }
       }
-      L<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' denied: TSIG signed request with principal '"<<q->d_peer_principal<<"' and algorithm 'gss-tsig' is not permitted"<<endl;
+      g_log<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' denied: TSIG signed request with principal '"<<q->d_peer_principal<<"' and algorithm 'gss-tsig' is not permitted"<<endl;
       return false;
     }
 
     if(!dk.TSIGGrantsAccess(q->qdomain, keyname)) {
-      L<<Logger::Error<<"AXFR '"<<q->qdomain<<"' denied: key with name '"<<keyname<<"' and algorithm '"<<getTSIGAlgoName(q->d_tsig_algo)<<"' does not grant access to zone"<<endl;
+      g_log<<Logger::Error<<"AXFR '"<<q->qdomain<<"' denied: key with name '"<<keyname<<"' and algorithm '"<<getTSIGAlgoName(q->d_tsig_algo)<<"' does not grant access to zone"<<endl;
       return false;
     }
     else {
-      L<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: TSIG signed request with authorized key '"<<keyname<<"' and algorithm '"<<getTSIGAlgoName(q->d_tsig_algo)<<"'"<<endl;
+      g_log<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: TSIG signed request with authorized key '"<<keyname<<"' and algorithm '"<<getTSIGAlgoName(q->d_tsig_algo)<<"'"<<endl;
       return true;
     }
   }
   
   // cerr<<"checking allow-axfr-ips"<<endl;
   if(!(::arg()["allow-axfr-ips"].empty()) && d_ng.match( (ComboAddress *) &q->d_remote )) {
-    L<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: client IP "<<q->getRemote()<<" is in allow-axfr-ips"<<endl;
+    g_log<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: client IP "<<q->getRemote()<<" is in allow-axfr-ips"<<endl;
     return true;
   }
 
@@ -497,7 +497,7 @@ bool TCPNameserver::canDoAXFR(shared_ptr<DNSPacket> q)
             if(*k == q->getRemote().toString())
             {
               // cerr<<"got AUTO-NS hit"<<endl;
-              L<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: client IP "<<q->getRemote()<<" is in NSset"<<endl;
+              g_log<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: client IP "<<q->getRemote()<<" is in NSset"<<endl;
               return true;
             }
           }
@@ -508,7 +508,7 @@ bool TCPNameserver::canDoAXFR(shared_ptr<DNSPacket> q)
         Netmask nm = Netmask(*i);
         if(nm.match( (ComboAddress *) &q->d_remote ))
         {
-          L<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: client IP "<<q->getRemote()<<" is in per-domain ACL"<<endl;
+          g_log<<Logger::Warning<<"AXFR of domain '"<<q->qdomain<<"' allowed: client IP "<<q->getRemote()<<" is in per-domain ACL"<<endl;
           // cerr<<"hit!"<<endl;
           return true;
         }
@@ -519,11 +519,11 @@ bool TCPNameserver::canDoAXFR(shared_ptr<DNSPacket> q)
   extern CommunicatorClass Communicator;
 
   if(Communicator.justNotified(q->qdomain, q->getRemote().toString())) { // we just notified this ip
-    L<<Logger::Warning<<"Approved AXFR of '"<<q->qdomain<<"' from recently notified slave "<<q->getRemote()<<endl;
+    g_log<<Logger::Warning<<"Approved AXFR of '"<<q->qdomain<<"' from recently notified slave "<<q->getRemote()<<endl;
     return true;
   }
 
-  L<<Logger::Error<<"AXFR of domain '"<<q->qdomain<<"' denied: client IP "<<q->getRemote()<<" has no permission"<<endl;
+  g_log<<Logger::Error<<"AXFR of domain '"<<q->qdomain<<"' denied: client IP "<<q->getRemote()<<" has no permission"<<endl;
   return false;
 }
 
@@ -572,20 +572,20 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
   if(q->d_dnssecOk)
     outpacket->d_dnssecOk=true; // RFC 5936, 2.2.5 'SHOULD'
 
-  L<<Logger::Error<<"AXFR of domain '"<<target<<"' initiated by "<<q->getRemote()<<endl;
+  g_log<<Logger::Error<<"AXFR of domain '"<<target<<"' initiated by "<<q->getRemote()<<endl;
 
   // determine if zone exists and AXFR is allowed using existing backend before spawning a new backend.
   SOAData sd;
   {
     Lock l(&s_plock);
-    DLOG(L<<"Looking for SOA"<<endl);    // find domain_id via SOA and list complete domain. No SOA, no AXFR
+    DLOG(g_log<<"Looking for SOA"<<endl);    // find domain_id via SOA and list complete domain. No SOA, no AXFR
     if(!s_P) {
-      L<<Logger::Error<<"TCP server is without backend connections in doAXFR, launching"<<endl;
+      g_log<<Logger::Error<<"TCP server is without backend connections in doAXFR, launching"<<endl;
       s_P=new PacketHandler;
     }
 
     if (!canDoAXFR(q)) {
-      L<<Logger::Error<<"AXFR of domain '"<<target<<"' failed: "<<q->getRemote()<<" may not request AXFR"<<endl;
+      g_log<<Logger::Error<<"AXFR of domain '"<<target<<"' failed: "<<q->getRemote()<<" may not request AXFR"<<endl;
       outpacket->setRcode(RCode::NotAuth);
       sendPacket(outpacket,outsock);
       return 0;
@@ -593,7 +593,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
 
     // canDoAXFR does all the ACL checks, and has the if(disable-axfr) shortcut, call it first.
     if(!s_P->getBackend()->getSOAUncached(target, sd)) {
-      L<<Logger::Error<<"AXFR of domain '"<<target<<"' failed: not authoritative"<<endl;
+      g_log<<Logger::Error<<"AXFR of domain '"<<target<<"' failed: not authoritative"<<endl;
       outpacket->setRcode(RCode::NotAuth);
       sendPacket(outpacket,outsock);
       return 0;
@@ -602,7 +602,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
 
   UeberBackend db;
   if(!db.getSOAUncached(target, sd)) {
-    L<<Logger::Error<<"AXFR of domain '"<<target<<"' failed: not authoritative in second instance"<<endl;
+    g_log<<Logger::Error<<"AXFR of domain '"<<target<<"' failed: not authoritative in second instance"<<endl;
     outpacket->setRcode(RCode::NotAuth);
     sendPacket(outpacket,outsock);
     return 0;
@@ -620,13 +620,13 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
   if(securedZone && dk.getNSEC3PARAM(target, &ns3pr, &narrow)) {
     NSEC3Zone=true;
     if(narrow) {
-      L<<Logger::Error<<"Not doing AXFR of an NSEC3 narrow zone '"<<target<<"' for "<<q->getRemote()<<endl;
+      g_log<<Logger::Error<<"Not doing AXFR of an NSEC3 narrow zone '"<<target<<"' for "<<q->getRemote()<<endl;
       noAXFRBecauseOfNSEC3Narrow=true;
     }
   }
 
   if(noAXFRBecauseOfNSEC3Narrow) {
-    L<<Logger::Error<<"AXFR of domain '"<<target<<"' denied to "<<q->getRemote()<<endl;
+    g_log<<Logger::Error<<"AXFR of domain '"<<target<<"' denied to "<<q->getRemote()<<endl;
     outpacket->setRcode(RCode::Refused);
     // FIXME: should actually figure out if we are auth over a zone, and send out 9 if we aren't
     sendPacket(outpacket,outsock);
@@ -647,11 +647,11 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
     if (algorithm != DNSName("gss-tsig")) {
       Lock l(&s_plock);
       if(!s_P->getBackend()->getTSIGKey(tsigkeyname, &algorithm, &tsig64)) {
-        L<<Logger::Error<<"TSIG key '"<<tsigkeyname<<"' for domain '"<<target<<"' not found"<<endl;
+        g_log<<Logger::Error<<"TSIG key '"<<tsigkeyname<<"' for domain '"<<target<<"' not found"<<endl;
         return 0;
       }
       if (B64Decode(tsig64, tsigsecret) == -1) {
-        L<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<tsigkeyname<<"' for domain '"<<target<<"'"<<endl;
+        g_log<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<tsigkeyname<<"' for domain '"<<target<<"'"<<endl;
         return 0;
       }
     }
@@ -661,7 +661,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
   UeberBackend signatureDB; 
   
   // SOA *must* go out first, our signing pipe might reorder
-  DLOG(L<<"Sending out SOA"<<endl);
+  DLOG(g_log<<"Sending out SOA"<<endl);
   DNSZoneRecord soa = makeEditedDNSZRFromSOAData(dk, sd);
   outpacket->addRecord(soa);
   if(securedZone && !presignedZone) {
@@ -757,7 +757,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
   
   // now start list zone
   if(!(sd.db->list(target, sd.domain_id))) {  
-    L<<Logger::Error<<"Backend signals error condition"<<endl;
+    g_log<<Logger::Error<<"Backend signals error condition"<<endl;
     outpacket->setRcode(RCode::ServFail);
     sendPacket(outpacket,outsock);
     return 0;
@@ -783,7 +783,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
         int ret1 = stubDoResolve(getRR<ALIASRecordContent>(zrr.dr)->d_content, QType::A, ips);
         int ret2 = stubDoResolve(getRR<ALIASRecordContent>(zrr.dr)->d_content, QType::AAAA, ips);
         if(ret1 != RCode::NoError || ret2 != RCode::NoError) {
-          L<<Logger::Error<<"Error resolving for ALIAS "<<zrr.dr.d_content->getZoneRepresentation()<<", aborting AXFR"<<endl;
+          g_log<<Logger::Error<<"Error resolving for ALIAS "<<zrr.dr.d_content->getZoneRepresentation()<<", aborting AXFR"<<endl;
           outpacket->setRcode(RCode::ServFail);
           sendPacket(outpacket,outsock);
           return 0;
@@ -809,7 +809,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
       zrrs.push_back(zrr);
     } else {
       if (zrr.dr.d_type)
-        L<<Logger::Warning<<"Zone '"<<target<<"' contains out-of-zone data '"<<zrr.dr.d_name<<"|"<<DNSRecordContent::NumberToType(zrr.dr.d_type)<<"', ignoring"<<endl;
+        g_log<<Logger::Warning<<"Zone '"<<target<<"' contains out-of-zone data '"<<zrr.dr.d_name<<"|"<<DNSRecordContent::NumberToType(zrr.dr.d_type)<<"', ignoring"<<endl;
     }
   }
 
@@ -865,7 +865,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
         while(shorter != target && shorter.chopOff()) {
           if(!qnames.count(shorter) && !nonterm.count(shorter) && nsec3set.count(shorter)) {
             if(!(maxent)) {
-              L<<Logger::Warning<<"Zone '"<<target<<"' has too many empty non terminals."<<endl;
+              g_log<<Logger::Warning<<"Zone '"<<target<<"' has too many empty non terminals."<<endl;
               return 0;
             }
             nonterm.insert(shorter);
@@ -1046,9 +1046,9 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
   
   udiff=dt.udiffNoReset();
   if(securedZone) 
-    L<<Logger::Info<<"Done signing: "<<csp.d_signed/(udiff/1000000.0)<<" sigs/s, "<<endl;
+    g_log<<Logger::Info<<"Done signing: "<<csp.d_signed/(udiff/1000000.0)<<" sigs/s, "<<endl;
   
-  DLOG(L<<"Done writing out records"<<endl);
+  DLOG(g_log<<"Done writing out records"<<endl);
   /* and terminate with yet again the SOA record */
   outpacket=getFreshAXFRPacket(q);
   outpacket->addRecord(soa);
@@ -1057,8 +1057,8 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr<DNSPacket> q, int ou
   
   sendPacket(outpacket, outsock);
   
-  DLOG(L<<"last packet - close"<<endl);
-  L<<Logger::Error<<"AXFR of domain '"<<target<<"' to "<<q->getRemote()<<" finished"<<endl;
+  DLOG(g_log<<"last packet - close"<<endl);
+  g_log<<Logger::Error<<"AXFR of domain '"<<target<<"' to "<<q->getRemote()<<" finished"<<endl;
 
   return 1;
 }
@@ -1081,40 +1081,40 @@ int TCPNameserver::doIXFR(shared_ptr<DNSPacket> q, int outsock)
           serial=pdns_stou(parts[2]);
         }
         catch(const std::out_of_range& oor) {
-          L<<Logger::Error<<"Invalid serial in IXFR query"<<endl;
+          g_log<<Logger::Error<<"Invalid serial in IXFR query"<<endl;
           outpacket->setRcode(RCode::FormErr);
           sendPacket(outpacket,outsock);
           return 0;
         }
       } else {
-        L<<Logger::Error<<"No serial in IXFR query"<<endl;
+        g_log<<Logger::Error<<"No serial in IXFR query"<<endl;
         outpacket->setRcode(RCode::FormErr);
         sendPacket(outpacket,outsock);
         return 0;
       }
     } else if (rr->d_type != QType::TSIG && rr->d_type != QType::OPT) {
-      L<<Logger::Error<<"Additional records in IXFR query, type: "<<QType(rr->d_type).getName()<<endl;
+      g_log<<Logger::Error<<"Additional records in IXFR query, type: "<<QType(rr->d_type).getName()<<endl;
       outpacket->setRcode(RCode::FormErr);
       sendPacket(outpacket,outsock);
       return 0;
     }
   }
 
-  L<<Logger::Error<<"IXFR of domain '"<<q->qdomain<<"' initiated by "<<q->getRemote()<<" with serial "<<serial<<endl;
+  g_log<<Logger::Error<<"IXFR of domain '"<<q->qdomain<<"' initiated by "<<q->getRemote()<<" with serial "<<serial<<endl;
 
   // determine if zone exists and AXFR is allowed using existing backend before spawning a new backend.
   SOAData sd;
   {
     Lock l(&s_plock);
-    DLOG(L<<"Looking for SOA"<<endl); // find domain_id via SOA and list complete domain. No SOA, no IXFR
+    DLOG(g_log<<"Looking for SOA"<<endl); // find domain_id via SOA and list complete domain. No SOA, no IXFR
     if(!s_P) {
-      L<<Logger::Error<<"TCP server is without backend connections in doIXFR, launching"<<endl;
+      g_log<<Logger::Error<<"TCP server is without backend connections in doIXFR, launching"<<endl;
       s_P=new PacketHandler;
     }
 
     // canDoAXFR does all the ACL checks, and has the if(disable-axfr) shortcut, call it first.
     if(!canDoAXFR(q) || !s_P->getBackend()->getSOAUncached(q->qdomain, sd)) {
-      L<<Logger::Error<<"IXFR of domain '"<<q->qdomain<<"' failed: not authoritative"<<endl;
+      g_log<<Logger::Error<<"IXFR of domain '"<<q->qdomain<<"' failed: not authoritative"<<endl;
       outpacket->setRcode(RCode::NotAuth);
       sendPacket(outpacket,outsock);
       return 0;
@@ -1129,8 +1129,8 @@ int TCPNameserver::doIXFR(shared_ptr<DNSPacket> q, int outsock)
   bool securedZone = dk.isSecuredZone(q->qdomain);
   if(dk.getNSEC3PARAM(q->qdomain, &ns3pr, &narrow)) {
     if(narrow) {
-      L<<Logger::Error<<"Not doing IXFR of an NSEC3 narrow zone."<<endl;
-      L<<Logger::Error<<"IXFR of domain '"<<q->qdomain<<"' denied to "<<q->getRemote()<<endl;
+      g_log<<Logger::Error<<"Not doing IXFR of an NSEC3 narrow zone."<<endl;
+      g_log<<Logger::Error<<"IXFR of domain '"<<q->qdomain<<"' denied to "<<q->getRemote()<<endl;
       outpacket->setRcode(RCode::Refused);
       sendPacket(outpacket,outsock);
       return 0;
@@ -1141,7 +1141,7 @@ int TCPNameserver::doIXFR(shared_ptr<DNSPacket> q, int outsock)
 
   UeberBackend db;
   if(!db.getSOAUncached(target, sd)) {
-    L<<Logger::Error<<"IXFR of domain '"<<target<<"' failed: not authoritative in second instance"<<endl;
+    g_log<<Logger::Error<<"IXFR of domain '"<<target<<"' failed: not authoritative in second instance"<<endl;
     outpacket->setRcode(RCode::NotAuth);
     sendPacket(outpacket,outsock);
     return 0;
@@ -1161,11 +1161,11 @@ int TCPNameserver::doIXFR(shared_ptr<DNSPacket> q, int outsock)
         algorithm = DNSName("hmac-md5");
       Lock l(&s_plock);
       if(!s_P->getBackend()->getTSIGKey(tsigkeyname, &algorithm, &tsig64)) {
-        L<<Logger::Error<<"TSIG key '"<<tsigkeyname<<"' for domain '"<<target<<"' not found"<<endl;
+        g_log<<Logger::Error<<"TSIG key '"<<tsigkeyname<<"' for domain '"<<target<<"' not found"<<endl;
         return 0;
       }
       if (B64Decode(tsig64, tsigsecret) == -1) {
-        L<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<tsigkeyname<<"' for domain '"<<target<<"'"<<endl;
+        g_log<<Logger::Error<<"Unable to Base-64 decode TSIG key '"<<tsigkeyname<<"' for domain '"<<target<<"'"<<endl;
         return 0;
       }
     }
@@ -1173,7 +1173,7 @@ int TCPNameserver::doIXFR(shared_ptr<DNSPacket> q, int outsock)
     UeberBackend signatureDB;
 
     // SOA *must* go out first, our signing pipe might reorder
-    DLOG(L<<"Sending out SOA"<<endl);
+    DLOG(g_log<<"Sending out SOA"<<endl);
     DNSZoneRecord soa = makeEditedDNSZRFromSOAData(dk, sd);
     outpacket->addRecord(soa);
     if(securedZone) {
@@ -1187,12 +1187,12 @@ int TCPNameserver::doIXFR(shared_ptr<DNSPacket> q, int outsock)
 
     sendPacket(outpacket, outsock);
 
-    L<<Logger::Error<<"IXFR of domain '"<<target<<"' to "<<q->getRemote()<<" finished"<<endl;
+    g_log<<Logger::Error<<"IXFR of domain '"<<target<<"' to "<<q->getRemote()<<" finished"<<endl;
 
     return 1;
   }
 
-  L<<Logger::Error<<"IXFR fallback to AXFR for domain '"<<target<<"' our serial "<<sd.serial<<endl;
+  g_log<<Logger::Error<<"IXFR fallback to AXFR for domain '"<<target<<"' our serial "<<sd.serial<<endl;
   return doAXFR(q->qdomain, q, outsock);
 }
 
@@ -1236,7 +1236,7 @@ TCPNameserver::TCPNameserver()
       
     int tmp=1;
     if(setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0) {
-      L<<Logger::Error<<"Setsockopt failed"<<endl;
+      g_log<<Logger::Error<<"Setsockopt failed"<<endl;
       _exit(1);  
     }
 
@@ -1244,10 +1244,10 @@ TCPNameserver::TCPNameserver()
 #ifdef TCP_FASTOPEN
       int fastOpenQueueSize = ::arg().asNum("tcp-fast-open");
       if (setsockopt(s, IPPROTO_TCP, TCP_FASTOPEN, &fastOpenQueueSize, sizeof fastOpenQueueSize) < 0) {
-        L<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
+        g_log<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
       }
 #else
-      L<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
+      g_log<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
 #endif
     }
 
@@ -1257,16 +1257,16 @@ TCPNameserver::TCPNameserver()
     if(::bind(s, (sockaddr*)&local, local.getSocklen())<0) {
       close(s);
       if( errno == EADDRNOTAVAIL && ! ::arg().mustDo("local-address-nonexist-fail") ) {
-        L<<Logger::Error<<"IPv4 Address " << *laddr << " does not exist on this server - skipping TCP bind" << endl;
+        g_log<<Logger::Error<<"IPv4 Address " << *laddr << " does not exist on this server - skipping TCP bind" << endl;
         continue;
       } else {
-        L<<Logger::Error<<"Unable to bind to TCP socket " << *laddr << ": "<<strerror(errno)<<endl;
+        g_log<<Logger::Error<<"Unable to bind to TCP socket " << *laddr << ": "<<strerror(errno)<<endl;
         throw PDNSException("Unable to bind to TCP socket");
       }
     }
     
     listen(s,128);
-    L<<Logger::Error<<"TCP server bound to "<<local.toStringWithPort()<<endl;
+    g_log<<Logger::Error<<"TCP server bound to "<<local.toStringWithPort()<<endl;
     d_sockets.push_back(s);
     struct pollfd pfd;
     memset(&pfd, 0, sizeof(pfd));
@@ -1288,7 +1288,7 @@ TCPNameserver::TCPNameserver()
 
     int tmp=1;
     if(setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0) {
-      L<<Logger::Error<<"Setsockopt failed"<<endl;
+      g_log<<Logger::Error<<"Setsockopt failed"<<endl;
       _exit(1);  
     }
 
@@ -1296,31 +1296,31 @@ TCPNameserver::TCPNameserver()
 #ifdef TCP_FASTOPEN
       int fastOpenQueueSize = ::arg().asNum("tcp-fast-open");
       if (setsockopt(s, IPPROTO_TCP, TCP_FASTOPEN, &fastOpenQueueSize, sizeof fastOpenQueueSize) < 0) {
-        L<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
+        g_log<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
       }
 #else
-      L<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
+      g_log<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
 #endif
     }
 
     if( ::arg().mustDo("non-local-bind") )
        Utility::setBindAny(AF_INET6, s);
     if(setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &tmp, sizeof(tmp)) < 0) {
-      L<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl;
+      g_log<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl;
     }
     if(bind(s, (const sockaddr*)&local, local.getSocklen())<0) {
       close(s);
       if( errno == EADDRNOTAVAIL && ! ::arg().mustDo("local-ipv6-nonexist-fail") ) {
-        L<<Logger::Error<<"IPv6 Address " << *laddr << " does not exist on this server - skipping TCP bind" << endl;
+        g_log<<Logger::Error<<"IPv6 Address " << *laddr << " does not exist on this server - skipping TCP bind" << endl;
         continue;
       } else {
-        L<<Logger::Error<<"Unable to bind to TCPv6 socket" << *laddr << ": "<<strerror(errno)<<endl;
+        g_log<<Logger::Error<<"Unable to bind to TCPv6 socket" << *laddr << ": "<<strerror(errno)<<endl;
         throw PDNSException("Unable to bind to TCPv6 socket");
       }
     }
     
     listen(s,128);
-    L<<Logger::Error<<"TCPv6 server bound to "<<local.toStringWithPort()<<endl; // this gets %eth0 right
+    g_log<<Logger::Error<<"TCPv6 server bound to "<<local.toStringWithPort()<<endl; // this gets %eth0 right
     d_sockets.push_back(s);
 
     struct pollfd pfd;
@@ -1354,10 +1354,10 @@ void TCPNameserver::thread()
           addrlen=remote.getSocklen();
 
           if((fd=accept(sock, (sockaddr*)&remote, &addrlen))<0) {
-            L<<Logger::Error<<"TCP question accept error: "<<strerror(errno)<<endl;
+            g_log<<Logger::Error<<"TCP question accept error: "<<strerror(errno)<<endl;
             
             if(errno==EMFILE) {
-              L<<Logger::Error<<"TCP handler out of filedescriptors, exiting, won't recover from this"<<endl;
+              g_log<<Logger::Error<<"TCP handler out of filedescriptors, exiting, won't recover from this"<<endl;
               _exit(1);
             }
           }
@@ -1365,7 +1365,7 @@ void TCPNameserver::thread()
             if (d_maxConnectionsPerClient) {
               std::lock_guard<std::mutex> lock(s_clientsCountMutex);
               if (s_clientsCount[remote] >= d_maxConnectionsPerClient) {
-                L<<Logger::Notice<<"Limit of simultaneous TCP connections per client reached for "<< remote<<", dropping"<<endl;
+                g_log<<Logger::Notice<<"Limit of simultaneous TCP connections per client reached for "<< remote<<", dropping"<<endl;
                 close(fd);
                 continue;
               }
@@ -1378,10 +1378,10 @@ void TCPNameserver::thread()
             int room;
             d_connectionroom_sem->getValue( &room);
             if(room<1)
-              L<<Logger::Warning<<"Limit of simultaneous TCP connections reached - raise max-tcp-connections"<<endl;
+              g_log<<Logger::Warning<<"Limit of simultaneous TCP connections reached - raise max-tcp-connections"<<endl;
 
             if(pthread_create(&tid, 0, &doConnection, reinterpret_cast<void*>(fd))) {
-              L<<Logger::Error<<"Error creating thread: "<<stringerror()<<endl;
+              g_log<<Logger::Error<<"Error creating thread: "<<stringerror()<<endl;
               d_connectionroom_sem->post();
               close(fd);
               decrementClientCount(remote);
@@ -1392,10 +1392,10 @@ void TCPNameserver::thread()
     }
   }
   catch(PDNSException &AE) {
-    L<<Logger::Error<<"TCP Nameserver thread dying because of fatal error: "<<AE.reason<<endl;
+    g_log<<Logger::Error<<"TCP Nameserver thread dying because of fatal error: "<<AE.reason<<endl;
   }
   catch(...) {
-    L<<Logger::Error<<"TCPNameserver dying because of an unexpected fatal error"<<endl;
+    g_log<<Logger::Error<<"TCPNameserver dying because of an unexpected fatal error"<<endl;
   }
   _exit(1); // take rest of server with us
 }
index 9ac8e117f052276f575eab701b768d838bc235bb..00ed0d729be015a640cbbe81bac538042914543e 100644 (file)
@@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(test_prequery) {
     try {
      std::rethrow_if_nested(e);
     } catch(const std::exception& exp) {
-     theL()<<"Extra info: "<<exp.what();
+     g_log<<"Extra info: "<<exp.what();
     }
   }
   delete r;
index 540ec6f1c9104a56a3d59444fff082134da61347..b8d9ce893e3fda1908350760bb4c908cc0c55f6a 100644 (file)
@@ -10,7 +10,7 @@ void PacketHandler::tkeyHandler(DNSPacket *p, DNSPacket *r) {
   bool sign = false;
 
   if (!p->getTKEYRecord(&tkey_in, &name)) {
-    L<<Logger::Error<<"TKEY request but no TKEY RR found"<<endl;
+    g_log<<Logger::Error<<"TKEY request but no TKEY RR found"<<endl;
     r->setRcode(RCode::FormErr);
     return;
   }
index 9c299be55633abd04227f9c51582005595f19468..3b7e3ff8f80d7cd04b145219bb55b98d4a7ad4be 100644 (file)
@@ -60,12 +60,12 @@ pthread_cond_t UeberBackend::d_cond = PTHREAD_COND_INITIALIZER;
 //! Loads a module and reports it to all UeberBackend threads
 bool UeberBackend::loadmodule(const string &name)
 {
-  L<<Logger::Warning <<"Loading '"<<name<<"'" << endl;
+  g_log<<Logger::Warning <<"Loading '"<<name<<"'" << endl;
 
   void *dlib=dlopen(name.c_str(), RTLD_NOW);
 
   if(dlib == NULL) {
-    L<<Logger::Error <<"Unable to load module '"<<name<<"': "<<dlerror() << endl;
+    g_log<<Logger::Error <<"Unable to load module '"<<name<<"': "<<dlerror() << endl;
     return false;
   }
 
@@ -279,14 +279,14 @@ bool UeberBackend::getAuth(const DNSName &target, const QType& qtype, SOAData* s
       cstat = cacheHas(d_question,d_answers);
 
       if(cstat == 1 && !d_answers.empty() && d_cache_ttl) {
-        DLOG(L<<Logger::Error<<"has pos cache entry: "<<shorter<<endl);
+        DLOG(g_log<<Logger::Error<<"has pos cache entry: "<<shorter<<endl);
         fillSOAData(d_answers[0], *sd);
 
         sd->db = 0;
         sd->qname = shorter;
         goto found;
       } else if(cstat == 0 && d_negcache_ttl) {
-        DLOG(L<<Logger::Error<<"has neg cache entry: "<<shorter<<endl);
+        DLOG(g_log<<Logger::Error<<"has neg cache entry: "<<shorter<<endl);
         continue;
       }
     }
@@ -297,26 +297,26 @@ bool UeberBackend::getAuth(const DNSName &target, const QType& qtype, SOAData* s
       vector<pair<size_t, SOAData> >::iterator j = bestmatch.begin();
       for(; i != backends.end() && j != bestmatch.end(); ++i, ++j) {
 
-        DLOG(L<<Logger::Error<<"backend: "<<i-backends.begin()<<", qname: "<<shorter<<endl);
+        DLOG(g_log<<Logger::Error<<"backend: "<<i-backends.begin()<<", qname: "<<shorter<<endl);
 
         if(j->first < shorter.wirelength()) {
-          DLOG(L<<Logger::Error<<"skipped, we already found a shorter best match in this backend: "<<j->second.qname<<endl);
+          DLOG(g_log<<Logger::Error<<"skipped, we already found a shorter best match in this backend: "<<j->second.qname<<endl);
           continue;
         } else if(j->first == shorter.wirelength()) {
-          DLOG(L<<Logger::Error<<"use shorter best match: "<<j->second.qname<<endl);
+          DLOG(g_log<<Logger::Error<<"use shorter best match: "<<j->second.qname<<endl);
           *sd = j->second;
           break;
         } else {
-          DLOG(L<<Logger::Error<<"lookup: "<<shorter<<endl);
+          DLOG(g_log<<Logger::Error<<"lookup: "<<shorter<<endl);
           if((*i)->getAuth(shorter, sd)) {
-            DLOG(L<<Logger::Error<<"got: "<<sd->qname<<endl);
+            DLOG(g_log<<Logger::Error<<"got: "<<sd->qname<<endl);
             j->first = sd->qname.wirelength();
             j->second = *sd;
             if(sd->qname == shorter) {
               break;
             }
           } else {
-            DLOG(L<<Logger::Error<<"no match for: "<<shorter<<endl);
+            DLOG(g_log<<Logger::Error<<"no match for: "<<shorter<<endl);
           }
         }
       }
@@ -324,13 +324,13 @@ bool UeberBackend::getAuth(const DNSName &target, const QType& qtype, SOAData* s
       // Add to cache
       if(i == backends.end()) {
         if(d_negcache_ttl) {
-          DLOG(L<<Logger::Error<<"add neg cache entry:"<<shorter<<endl);
+          DLOG(g_log<<Logger::Error<<"add neg cache entry:"<<shorter<<endl);
           d_question.qname=shorter;
           addNegCache(d_question);
         }
         continue;
       } else if(d_cache_ttl) {
-        DLOG(L<<Logger::Error<<"add pos cache entry: "<<sd->qname<<endl);
+        DLOG(g_log<<Logger::Error<<"add pos cache entry: "<<sd->qname<<endl);
         d_question.qtype = QType::SOA;
         d_question.qname = sd->qname;
         d_question.zoneId = -1;
@@ -348,10 +348,10 @@ bool UeberBackend::getAuth(const DNSName &target, const QType& qtype, SOAData* s
 
 found:
     if(found == (qtype == QType::DS) || target != shorter) {
-      DLOG(L<<Logger::Error<<"found: "<<sd->qname<<endl);
+      DLOG(g_log<<Logger::Error<<"found: "<<sd->qname<<endl);
       return true;
     } else {
-      DLOG(L<<Logger::Error<<"chasing next: "<<sd->qname<<endl);
+      DLOG(g_log<<Logger::Error<<"chasing next: "<<sd->qname<<endl);
       found = true;
     }
 
@@ -463,7 +463,7 @@ int UeberBackend::cacheHas(const Question &q, vector<DNSZoneRecord> &rrs)
   }
 
   rrs.clear();
-  //  L<<Logger::Warning<<"looking up: '"<<q.qname+"'|N|"+q.qtype.getName()+"|"+itoa(q.zoneId)<<endl;
+  //  g_log<<Logger::Warning<<"looking up: '"<<q.qname+"'|N|"+q.qtype.getName()+"|"+itoa(q.zoneId)<<endl;
 
   bool ret=QC.getEntry(q.qname, q.qtype, rrs, q.zoneId);   // think about lowercasing here
   if(!ret) {
@@ -510,7 +510,7 @@ void UeberBackend::alsoNotifies(const DNSName &domain, set<string> *ips)
 
 UeberBackend::~UeberBackend()
 {
-  DLOG(L<<Logger::Error<<"UeberBackend destructor called, removing ourselves from instances, and deleting our backends"<<endl);
+  DLOG(g_log<<Logger::Error<<"UeberBackend destructor called, removing ourselves from instances, and deleting our backends"<<endl);
   cleanup();
 }
 
@@ -518,17 +518,17 @@ UeberBackend::~UeberBackend()
 void UeberBackend::lookup(const QType &qtype,const DNSName &qname, DNSPacket *pkt_p, int zoneId)
 {
   if(d_stale) {
-    L<<Logger::Error<<"Stale ueberbackend received question, signalling that we want to be recycled"<<endl;
+    g_log<<Logger::Error<<"Stale ueberbackend received question, signalling that we want to be recycled"<<endl;
     throw PDNSException("We are stale, please recycle");
   }
 
-  DLOG(L<<"UeberBackend received question for "<<qtype.getName()<<" of "<<qname<<endl);
+  DLOG(g_log<<"UeberBackend received question for "<<qtype.getName()<<" of "<<qname<<endl);
   if(!d_go) {
     pthread_mutex_lock(&d_mut);
     while (d_go==false) {
-      L<<Logger::Error<<"UeberBackend is blocked, waiting for 'go'"<<endl;
+      g_log<<Logger::Error<<"UeberBackend is blocked, waiting for 'go'"<<endl;
       pthread_cond_wait(&d_cond, &d_mut);
-      L<<Logger::Error<<"Broadcast received, unblocked"<<endl;
+      g_log<<Logger::Error<<"Broadcast received, unblocked"<<endl;
     }
     pthread_mutex_unlock(&d_mut);
   }
@@ -542,7 +542,7 @@ void UeberBackend::lookup(const QType &qtype,const DNSName &qname, DNSPacket *pk
   d_ancount=0;
 
   if(!backends.size()) {
-    L<<Logger::Error<<"No database backends available - unable to answer questions."<<endl;
+    g_log<<Logger::Error<<"No database backends available - unable to answer questions."<<endl;
     d_stale=true; // please recycle us!
     throw PDNSException("We are stale, please recycle");
   }
@@ -633,7 +633,7 @@ AtomicCounter UeberBackend::handle::instances(0);
 
 UeberBackend::handle::handle()
 {
-  //  L<<Logger::Warning<<"Handle instances: "<<instances<<endl;
+  //  g_log<<Logger::Warning<<"Handle instances: "<<instances<<endl;
   ++instances;
   parent=NULL;
   d_hinterBackend=NULL;
@@ -648,11 +648,11 @@ UeberBackend::handle::~handle()
 
 bool UeberBackend::handle::get(DNSZoneRecord &r)
 {
-  DLOG(L << "Ueber get() was called for a "<<qtype.getName()<<" record" << endl);
+  DLOG(g_log << "Ueber get() was called for a "<<qtype.getName()<<" record" << endl);
   bool isMore=false;
   while(d_hinterBackend && !(isMore=d_hinterBackend->get(r))) { // this backend out of answers
     if(i<parent->backends.size()) {
-      DLOG(L<<"Backend #"<<i<<" of "<<parent->backends.size()
+      DLOG(g_log<<"Backend #"<<i<<" of "<<parent->backends.size()
            <<" out of answers, taking next"<<endl);
       
       d_hinterBackend=parent->backends[i++];
@@ -661,15 +661,15 @@ bool UeberBackend::handle::get(DNSZoneRecord &r)
     else 
       break;
 
-    DLOG(L<<"Now asking backend #"<<i<<endl);
+    DLOG(g_log<<"Now asking backend #"<<i<<endl);
   }
 
   if(!isMore && i==parent->backends.size()) {
-    DLOG(L<<"UeberBackend reached end of backends"<<endl);
+    DLOG(g_log<<"UeberBackend reached end of backends"<<endl);
     return false;
   }
 
-  DLOG(L<<"Found an answering backend - will not try another one"<<endl);
+  DLOG(g_log<<"Found an answering backend - will not try another one"<<endl);
   i=parent->backends.size(); // don't go on to the next backend
   return true;
 }
index 5257d861a6cabe2c3443013c1259889708b2cf11..a4b25b6dd0a1ed87289ffb90bc2f1d4241930ee4 100644 (file)
@@ -150,7 +150,7 @@ Semaphore::Semaphore(unsigned int value)
 {
   m_pSemaphore=new sem_t;
   if (sem_init(m_pSemaphore, 0, value) == -1) {
-    theL() << Logger::Error << "Cannot create semaphore: " << stringerror() << endl;
+    g_log << Logger::Error << "Cannot create semaphore: " << stringerror() << endl;
     exit(1);
   }
 }
index 5f5bb822cd65a5025b9436aa928f32bcb1753d91..e842374e532d8c7e80e2de9565ab22e94efabcfc 100644 (file)
@@ -84,22 +84,22 @@ void Utility::setBindAny(int af, sock_t sock)
   (void) one; // avoids 'unused var' warning on systems that have none of the defines checked below
 #ifdef IP_FREEBIND
   if (setsockopt(sock, IPPROTO_IP, IP_FREEBIND, &one, sizeof(one)) < 0)
-      theL()<<Logger::Warning<<"Warning: IP_FREEBIND setsockopt failed: "<<strerror(errno)<<endl;
+      g_log<<Logger::Warning<<"Warning: IP_FREEBIND setsockopt failed: "<<strerror(errno)<<endl;
 #endif
 
 #ifdef IP_BINDANY
   if (af == AF_INET)
     if (setsockopt(sock, IPPROTO_IP, IP_BINDANY, &one, sizeof(one)) < 0)
-      theL()<<Logger::Warning<<"Warning: IP_BINDANY setsockopt failed: "<<strerror(errno)<<endl;
+      g_log<<Logger::Warning<<"Warning: IP_BINDANY setsockopt failed: "<<strerror(errno)<<endl;
 #endif
 #ifdef IPV6_BINDANY
   if (af == AF_INET6)
     if (setsockopt(sock, IPPROTO_IPV6, IPV6_BINDANY, &one, sizeof(one)) < 0)
-      theL()<<Logger::Warning<<"Warning: IPV6_BINDANY setsockopt failed: "<<strerror(errno)<<endl;
+      g_log<<Logger::Warning<<"Warning: IPV6_BINDANY setsockopt failed: "<<strerror(errno)<<endl;
 #endif
 #ifdef SO_BINDANY
   if (setsockopt(sock, SOL_SOCKET, SO_BINDANY, &one, sizeof(one)) < 0)
-      theL()<<Logger::Warning<<"Warning: SO_BINDANY setsockopt failed: "<<strerror(errno)<<endl;
+      g_log<<Logger::Warning<<"Warning: SO_BINDANY setsockopt failed: "<<strerror(errno)<<endl;
 #endif
 }
 
@@ -128,22 +128,22 @@ void Utility::dropGroupPrivs( int uid, int gid )
 {
   if(gid) {
     if(setgid(gid)<0) {
-      theL()<<Logger::Critical<<"Unable to set effective group id to "<<gid<<": "<<stringerror()<<endl;
+      g_log<<Logger::Critical<<"Unable to set effective group id to "<<gid<<": "<<stringerror()<<endl;
       exit(1);
     }
     else
-      theL()<<Logger::Info<<"Set effective group id to "<<gid<<endl;
+      g_log<<Logger::Info<<"Set effective group id to "<<gid<<endl;
 
     struct passwd *pw=getpwuid(uid);
     if(!pw) {
-      theL()<<Logger::Warning<<"Unable to determine user name for uid "<<uid<<endl;
+      g_log<<Logger::Warning<<"Unable to determine user name for uid "<<uid<<endl;
       if (setgroups(0, NULL)<0) {
-        theL()<<Logger::Critical<<"Unable to drop supplementary gids: "<<stringerror()<<endl;
+        g_log<<Logger::Critical<<"Unable to drop supplementary gids: "<<stringerror()<<endl;
         exit(1);
       }
     } else {
       if (initgroups(pw->pw_name, gid)<0) {
-        theL()<<Logger::Critical<<"Unable to set supplementary groups: "<<stringerror()<<endl;
+        g_log<<Logger::Critical<<"Unable to set supplementary groups: "<<stringerror()<<endl;
         exit(1);
       }
     }
@@ -156,11 +156,11 @@ void Utility::dropUserPrivs( int uid )
 {
   if(uid) {
     if(setuid(uid)<0) {
-      theL()<<Logger::Critical<<"Unable to set effective user id to "<<uid<<":  "<<stringerror()<<endl;
+      g_log<<Logger::Critical<<"Unable to set effective user id to "<<uid<<":  "<<stringerror()<<endl;
       exit(1);
     }
     else
-      theL()<<Logger::Info<<"Set effective user id to "<<uid<<endl;
+      g_log<<Logger::Info<<"Set effective user id to "<<uid<<endl;
   }
 }
 
@@ -188,7 +188,7 @@ int Utility::makeGidNumeric(const string &group)
     errno=0;
     struct group *gr=getgrnam(group.c_str());
     if(!gr) {
-      theL()<<Logger::Critical<<"Unable to look up gid of group '"<<group<<"': "<< (errno ? strerror(errno) : "not found") <<endl;
+      g_log<<Logger::Critical<<"Unable to look up gid of group '"<<group<<"': "<< (errno ? strerror(errno) : "not found") <<endl;
       exit(1);
     }
     newgid=gr->gr_gid;
@@ -204,7 +204,7 @@ int Utility::makeUidNumeric(const string &username)
   if(!(newuid=atoi(username.c_str()))) {
     struct passwd *pw=getpwnam(username.c_str());
     if(!pw) {
-      theL()<<Logger::Critical<<"Unable to look up uid of user '"<<username<<"': "<< (errno ? strerror(errno) : "not found") <<endl;
+      g_log<<Logger::Critical<<"Unable to look up uid of user '"<<username<<"': "<< (errno ? strerror(errno) : "not found") <<endl;
       exit(1);
     }
     newuid=pw->pw_uid;
index 83e383328bdc150e7d7724007a514b4656b41724..3299631318a1598f928db2ebb00c8d205ab19195 100644 (file)
@@ -13,7 +13,7 @@ bool checkDNSSECDisabled() {
 bool warnIfDNSSECDisabled(const string& msg) {
   if(g_dnssecmode == DNSSECMode::Off) {
     if (!msg.empty())
-      L<<Logger::Warning<<msg<<endl;
+      g_log<<Logger::Warning<<msg<<endl;
     return true;
   }
   return false;
index 2aa29748d5212006d969dccf9615d93713206364..3f7e0dafe6c5fce84ccbe0a44064e7b84cc11328 100644 (file)
@@ -8,7 +8,7 @@
 bool g_dnssecLOG{false};
 uint16_t g_maxNSEC3Iterations{0};
 
-#define LOG(x) if(g_dnssecLOG) { L <<Logger::Warning << x; }
+#define LOG(x) if(g_dnssecLOG) { g_log <<Logger::Warning << x; }
 void dotEdge(DNSName zone, string type1, DNSName name1, string tag1, string type2, DNSName name2, string tag2, string color="");
 void dotNode(string type, DNSName name, string tag, string content);
 string dotName(string type, DNSName name, string tag);
index 8dbb9f322f8b10dbf3bbf0942892d158207ce8ce..57d622a9bc72aba1203ed9e7e0861a15025facda 100644 (file)
@@ -71,22 +71,22 @@ string productTypeApiType() {
 
 void showProductVersion()
 {
-  theL()<<Logger::Warning<<productName()<<" "<< VERSION << " (C) 2001-2018 "
+  g_log<<Logger::Warning<<productName()<<" "<< VERSION << " (C) 2001-2018 "
     "PowerDNS.COM BV" << endl;
-  theL()<<Logger::Warning<<"Using "<<(sizeof(unsigned long)*8)<<"-bits mode. "
+  g_log<<Logger::Warning<<"Using "<<(sizeof(unsigned long)*8)<<"-bits mode. "
     "Built using " << compilerVersion()
 #ifndef REPRODUCIBLE
     <<" on " __DATE__ " " __TIME__ " by " BUILD_HOST
 #endif
     <<"."<< endl;
-  theL()<<Logger::Warning<<"PowerDNS comes with ABSOLUTELY NO WARRANTY. "
+  g_log<<Logger::Warning<<"PowerDNS comes with ABSOLUTELY NO WARRANTY. "
     "This is free software, and you are welcome to redistribute it "
     "according to the terms of the GPL version 2." << endl;
 }
 
 void showBuildConfiguration()
 {
-  theL()<<Logger::Warning<<"Features: "<<
+  g_log<<Logger::Warning<<"Features: "<<
 #ifdef HAVE_BOTAN
     "botan" << BOTAN_VERSION_MAJOR << "." << BOTAN_VERSION_MINOR  << " " <<
 #endif
@@ -115,12 +115,12 @@ void showBuildConfiguration()
     endl;
 #ifdef PDNS_MODULES
   // Auth only
-  theL()<<Logger::Warning<<"Built-in modules: "<<PDNS_MODULES<<endl;
+  g_log<<Logger::Warning<<"Built-in modules: "<<PDNS_MODULES<<endl;
 #endif
 #ifdef PDNS_CONFIG_ARGS
 #define double_escape(s) #s
 #define escape_quotes(s) double_escape(s)
-  theL()<<Logger::Warning<<"Configured with: "<<escape_quotes(PDNS_CONFIG_ARGS)<<endl;
+  g_log<<Logger::Warning<<"Configured with: "<<escape_quotes(PDNS_CONFIG_ARGS)<<endl;
 #undef escape_quotes
 #undef double_escape
 #endif
index f1a95f4e219e564c3d1dcfe7b22fa8e67e5ee9ea..af0a17e4d9f56c30ba6876b64723b3a5ce157d70 100644 (file)
@@ -39,12 +39,12 @@ json11::Json HttpRequest::json()
 {
   string err;
   if(this->body.empty()) {
-    L<<Logger::Debug<<"HTTP: JSON document expected in request body, but body was empty" << endl;
+    g_log<<Logger::Debug<<"HTTP: JSON document expected in request body, but body was empty" << endl;
     throw HttpBadRequestException();
   }
   json11::Json doc = json11::Json::parse(this->body, err);
   if (doc.is_null()) {
-    L<<Logger::Debug<<"HTTP: parsing of JSON document failed:" << err << endl;
+    g_log<<Logger::Debug<<"HTTP: parsing of JSON document failed:" << err << endl;
     throw HttpBadRequestException();
   }
   return doc;
@@ -132,13 +132,13 @@ static void apiWrapper(WebServer::HandlerFunction handler, HttpRequest* req, Htt
   resp->headers["access-control-allow-origin"] = "*";
 
   if (api_key.empty()) {
-    L<<Logger::Error<<"HTTP API Request \"" << req->url.path << "\": Authentication failed, API Key missing in config" << endl;
+    g_log<<Logger::Error<<"HTTP API Request \"" << req->url.path << "\": Authentication failed, API Key missing in config" << endl;
     throw HttpUnauthorizedException("X-API-Key");
   }
   bool auth_ok = req->compareHeader("x-api-key", api_key) || req->getvars["api-key"]==api_key;
   
   if (!auth_ok) {
-    L<<Logger::Error<<"HTTP Request \"" << req->url.path << "\": Authentication by API Key failed" << endl;
+    g_log<<Logger::Error<<"HTTP Request \"" << req->url.path << "\": Authentication by API Key failed" << endl;
     throw HttpUnauthorizedException("X-API-Key");
   }
 
@@ -181,7 +181,7 @@ static void webWrapper(WebServer::HandlerFunction handler, HttpRequest* req, Htt
   if (!web_password.empty()) {
     bool auth_ok = req->compareAuthorization(web_password);
     if (!auth_ok) {
-      L<<Logger::Debug<<"HTTP Request \"" << req->url.path << "\": Web Authentication failed" << endl;
+      g_log<<Logger::Debug<<"HTTP Request \"" << req->url.path << "\": Web Authentication failed" << endl;
       throw HttpUnauthorizedException("Basic");
     }
   }
@@ -206,11 +206,11 @@ void WebServer::handleRequest(HttpRequest& req, HttpResponse& resp) const
 
   try {
     if (!req.complete) {
-      L<<Logger::Debug<<"HTTP: Incomplete request" << endl;
+      g_log<<Logger::Debug<<"HTTP: Incomplete request" << endl;
       throw HttpBadRequestException();
     }
 
-    L<<Logger::Debug<<"HTTP: Handling request \"" << req.url.path << "\"" << endl;
+    g_log<<Logger::Debug<<"HTTP: Handling request \"" << req.url.path << "\"" << endl;
 
     YaHTTP::strstr_map_t::iterator header;
 
@@ -225,33 +225,33 @@ void WebServer::handleRequest(HttpRequest& req, HttpResponse& resp) const
 
     YaHTTP::THandlerFunction handler;
     if (!YaHTTP::Router::Route(&req, handler)) {
-      L<<Logger::Debug<<"HTTP: No route found for \"" << req.url.path << "\"" << endl;
+      g_log<<Logger::Debug<<"HTTP: No route found for \"" << req.url.path << "\"" << endl;
       throw HttpNotFoundException();
     }
 
     try {
       handler(&req, &resp);
-      L<<Logger::Debug<<"HTTP: Result for \"" << req.url.path << "\": " << resp.status << ", body length: " << resp.body.size() << endl;
+      g_log<<Logger::Debug<<"HTTP: Result for \"" << req.url.path << "\": " << resp.status << ", body length: " << resp.body.size() << endl;
     }
     catch(HttpException&) {
       throw;
     }
     catch(PDNSException &e) {
-      L<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": Exception: " << e.reason << endl;
+      g_log<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": Exception: " << e.reason << endl;
       throw HttpInternalServerErrorException();
     }
     catch(std::exception &e) {
-      L<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": STL Exception: " << e.what() << endl;
+      g_log<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": STL Exception: " << e.what() << endl;
       throw HttpInternalServerErrorException();
     }
     catch(...) {
-      L<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": Unknown Exception" << endl;
+      g_log<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": Unknown Exception" << endl;
       throw HttpInternalServerErrorException();
     }
   }
   catch(HttpException &e) {
     resp = e.response();
-    L<<Logger::Debug<<"HTTP: Error result for \"" << req.url.path << "\": " << resp.status << endl;
+    g_log<<Logger::Debug<<"HTTP: Error result for \"" << req.url.path << "\": " << resp.status << endl;
     string what = YaHTTP::Utility::status2text(resp.status);
     if(req.accept_html) {
       resp.headers["Content-Type"] = "text/html; charset=utf-8";
@@ -311,14 +311,14 @@ try {
   client->writenWithTimeout(reply.c_str(), reply.size(), timeout);
 }
 catch(PDNSException &e) {
-  L<<Logger::Error<<"HTTP Exception: "<<e.reason<<endl;
+  g_log<<Logger::Error<<"HTTP Exception: "<<e.reason<<endl;
 }
 catch(std::exception &e) {
   if(strstr(e.what(), "timeout")==0)
-    L<<Logger::Error<<"HTTP STL Exception: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"HTTP STL Exception: "<<e.what()<<endl;
 }
 catch(...) {
-  L<<Logger::Error<<"HTTP: Unknown exception"<<endl;
+  g_log<<Logger::Error<<"HTTP: Unknown exception"<<endl;
 }
 
 WebServer::WebServer(const string &listenaddress, int port) : d_server(nullptr)
@@ -331,10 +331,10 @@ void WebServer::bind()
 {
   try {
     d_server = createServer();
-    L<<Logger::Warning<<"Listening for HTTP requests on "<<d_server->d_local.toStringWithPort()<<endl;
+    g_log<<Logger::Warning<<"Listening for HTTP requests on "<<d_server->d_local.toStringWithPort()<<endl;
   }
   catch(NetworkError &e) {
-    L<<Logger::Error<<"Listening on HTTP socket failed: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"Listening on HTTP socket failed: "<<e.what()<<endl;
     d_server = nullptr;
   }
 }
@@ -359,28 +359,28 @@ void WebServer::go()
         } else {
           ComboAddress remote;
           if (client->getRemote(remote))
-            L<<Logger::Error<<"Webserver closing socket: remote ("<< remote.toString() <<") does not match 'webserver-allow-from'"<<endl;
+            g_log<<Logger::Error<<"Webserver closing socket: remote ("<< remote.toString() <<") does not match 'webserver-allow-from'"<<endl;
         }
       }
       catch(PDNSException &e) {
-        L<<Logger::Error<<"PDNSException while accepting a connection in main webserver thread: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"PDNSException while accepting a connection in main webserver thread: "<<e.reason<<endl;
       }
       catch(std::exception &e) {
-        L<<Logger::Error<<"STL Exception while accepting a connection in main webserver thread: "<<e.what()<<endl;
+        g_log<<Logger::Error<<"STL Exception while accepting a connection in main webserver thread: "<<e.what()<<endl;
       }
       catch(...) {
-        L<<Logger::Error<<"Unknown exception while accepting a connection in main webserver thread"<<endl;
+        g_log<<Logger::Error<<"Unknown exception while accepting a connection in main webserver thread"<<endl;
       }
     }
   }
   catch(PDNSException &e) {
-    L<<Logger::Error<<"PDNSException in main webserver thread: "<<e.reason<<endl;
+    g_log<<Logger::Error<<"PDNSException in main webserver thread: "<<e.reason<<endl;
   }
   catch(std::exception &e) {
-    L<<Logger::Error<<"STL Exception in main webserver thread: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"STL Exception in main webserver thread: "<<e.what()<<endl;
   }
   catch(...) {
-    L<<Logger::Error<<"Unknown exception in main webserver thread"<<endl;
+    g_log<<Logger::Error<<"Unknown exception in main webserver thread"<<endl;
   }
   _exit(1);
 }
index eada20704ef0468b0480fc76b9489cc8d0a0f7b3..72ecc517451258adc704c2585a6d6699cac5d28d 100644 (file)
@@ -85,7 +85,7 @@ void AuthWebServer::statThread()
     }
   }
   catch(...) {
-    L<<Logger::Error<<"Webserver statThread caught an exception, dying"<<endl;
+    g_log<<Logger::Error<<"Webserver statThread caught an exception, dying"<<endl;
     _exit(1);
   }
 }
@@ -1885,7 +1885,7 @@ void AuthWebServer::webThread()
     d_ws->go();
   }
   catch(...) {
-    L<<Logger::Error<<"AuthWebServer thread caught an exception, dying"<<endl;
+    g_log<<Logger::Error<<"AuthWebServer thread caught an exception, dying"<<endl;
     _exit(1);
   }
 }
index 7e8e99468429eeb7c10b804cf39420b7fa2f99a9..2d153f7dc9217c46e087c32c2a409dc8b8ad0c71 100644 (file)
@@ -584,11 +584,11 @@ void AsyncServerNewConnectionMT(void *p) {
     }
   } catch (NetworkError &e) {
     // we're running in a shared process/thread, so can't just terminate/abort.
-    L<<Logger::Warning<<"Network error in web thread: "<<e.what()<<endl;
+    g_log<<Logger::Warning<<"Network error in web thread: "<<e.what()<<endl;
     return;
   }
   catch (...) {
-    L<<Logger::Warning<<"Unknown error in web thread"<<endl;
+    g_log<<Logger::Warning<<"Unknown error in web thread"<<endl;
 
     return;
   }
@@ -638,18 +638,18 @@ try {
 
   // now send the reply
   if (asendtcp(data, client.get()) == -1 || data.empty()) {
-    L<<Logger::Error<<"Failed sending reply to HTTP client"<<endl;
+    g_log<<Logger::Error<<"Failed sending reply to HTTP client"<<endl;
   }
 }
 catch(PDNSException &e) {
-  L<<Logger::Error<<"HTTP Exception: "<<e.reason<<endl;
+  g_log<<Logger::Error<<"HTTP Exception: "<<e.reason<<endl;
 }
 catch(std::exception &e) {
   if(strstr(e.what(), "timeout")==0)
-    L<<Logger::Error<<"HTTP STL Exception: "<<e.what()<<endl;
+    g_log<<Logger::Error<<"HTTP STL Exception: "<<e.what()<<endl;
 }
 catch(...) {
-  L<<Logger::Error<<"HTTP: Unknown exception"<<endl;
+  g_log<<Logger::Error<<"HTTP: Unknown exception"<<endl;
 }
 
 void AsyncWebServer::go() {