]> granicus.if.org Git - pdns/commitdiff
more logging && service fixes
authorBert Hubert <bert.hubert@netherlabs.nl>
Sun, 30 Apr 2006 15:29:11 +0000 (15:29 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sun, 30 Apr 2006 15:29:11 +0000 (15:29 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@816 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/pdns_recursor.cc
pdns/recursorservice.cc
pdns/win32_logger.cc

index 38b5cd1c8ac956e36dcf5193b281fb4713a192a6..d68b4532519c7160d61e2644737a7be3cfa6e5b5 100644 (file)
@@ -1273,7 +1273,7 @@ void parseAuthAndForwards()
   }
 }
 
-int serviceMain(int argc, char**argv)
+int serviceMain(int argc, char*argv[])
 {
   L.setName("pdns_recursor");
 
@@ -1556,6 +1556,7 @@ int main(int argc, char **argv)
     serviceMain(argc, argv);
 #else
     doWindowsServiceArguments(service);
+       L.toNTLog();
     RecursorService::instance()->start( argc, argv, ::arg().mustDo( "ntservice" )); 
 #endif
 
index 6f95e95f9106c4dda48faf57d23c74656c6a80a8..d16d9191a1f9e9ea10b91961fc624e21888dc016 100644 (file)
@@ -6,7 +6,6 @@
     it under the terms of the GNU General Public License version 2
     as published by the Free Software Foundation
     
-
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
index 9f38afff55babc915e2b81c10e67fc7cce45e096..d7cbe60346dc126765243711b7f21b4f6b5cc0dc 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "utility.hh"
 #include "logger.hh"
-
+#include "ntservice.hh" 
+#include "pdnsmsg.hh"
 using namespace std;
 
 Logger &theL(const string &pname)
@@ -48,6 +49,8 @@ void Logger::log(const string &msg, Urgency u)
     fwrite( message.str().c_str(), sizeof( char ), message.str().length(), m_pLogFile );
     fflush( m_pLogFile );
   }
+  if(m_eventLogHandle)
+    ReportEvent( m_eventLogHandle, u, 0, MSG_WARNING, NULL, 1, 0, tmp, NULL );
 
   clog << timestr<<" " <<msg << endl;
   return;
@@ -67,7 +70,8 @@ void Logger::toFile( const string & filename )
 
 void Logger::toNTLog( void )
 {
-
+  m_eventLogHandle = RegisterEventSource( NULL, 
+         NTService::instance()->getServiceName().c_str());
 }
 
 void Logger::open()