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);
}
}
}
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;
}
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);
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;
}
}
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);
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;
}
}
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;
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;
}
}
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;
}
}
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();
}