]> granicus.if.org Git - pdns/commitdiff
Add loglevel config setting to recursor
authorChristian Hofstaedtler <christian@hofstaedtler.name>
Mon, 10 Mar 2014 11:18:39 +0000 (12:18 +0100)
committerChristian Hofstaedtler <christian@hofstaedtler.name>
Mon, 10 Mar 2014 11:22:09 +0000 (12:22 +0100)
pdns/docs/pdns.xml
pdns/pdns_recursor.cc

index e0e33a679ce704da86a838da5105d13610ee828c..29988bf80fe0afb8a83fd8d6e8e7fd30cf9b7ba4 100644 (file)
@@ -14362,6 +14362,15 @@ sql> insert into domainmetadata (domain_id, kind, content) values (6, 'TSIG-ALLO
            </listitem>
          </varlistentry>
 
+         <varlistentry>
+           <term>loglevel</term>
+           <listitem>
+             <para>
+               Amount of logging. Higher is more, more logging may destroy performance. Available since 3.6.
+             </para>
+           </listitem>
+         </varlistentry>
+
          <varlistentry>
            <term>log-common-errors</term>
            <listitem>
index 52a6e149eea2f7ebe3576b4ee96fbd75676eda0f..78f99db3c75449a393582318dadcb39a2a68c4d6 100644 (file)
@@ -2057,6 +2057,7 @@ int main(int argc, char **argv)
     ::arg().set("local-address","IP addresses to listen on, separated by spaces or commas. Also accepts ports.")="127.0.0.1";
     ::arg().set("trace","if we should output heaps of logging. set to 'fail' to only log failing domains")="off";
     ::arg().set("daemon","Operate as a daemon")="yes";
+    ::arg().set("loglevel","Amount of logging. Higher is more. Do not set below 3")="4";
     ::arg().set("log-common-errors","If we should log rather common errors")="yes";
     ::arg().set("chroot","switch to chroot jail")="";
     ::arg().set("setgid","If set, change group id to this gid for more security")="";
@@ -2159,6 +2160,12 @@ int main(int argc, char **argv)
       exit(99);
     }
 
+    Logger::Urgency logUrgency = (Logger::Urgency)::arg().asNum("loglevel");
+    if (logUrgency < Logger::Error)
+      logUrgency = Logger::Error;
+    L.setLoglevel(logUrgency);
+    L.toConsole(logUrgency);
+
     serviceMain(argc, argv);
   }
   catch(PDNSException &ae) {