From 4345853ee29c0faa8cf1cef74ee971e395e7520f Mon Sep 17 00:00:00 2001
From: unknown <tulin@dl145b.mysql.com>
Date: Mon, 5 Sep 2005 09:29:28 +0200
Subject: [PATCH] added timestamp to shutdown messages in ndbd

---
 ndb/src/kernel/main.cpp        |  2 +-
 ndb/src/kernel/vm/Emulator.cpp | 26 ++++++++++++++------------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp
index 1e5cd5270e4..1cab3c96d19 100644
--- a/ndb/src/kernel/main.cpp
+++ b/ndb/src/kernel/main.cpp
@@ -57,7 +57,7 @@ int main(int argc, char** argv)
   NDB_INIT(argv[0]);
   // Print to stdout/console
   g_eventLogger.createConsoleHandler();
-  g_eventLogger.setCategory("NDB");
+  g_eventLogger.setCategory("ndbd");
   g_eventLogger.enable(Logger::LL_ON, Logger::LL_CRITICAL);
   g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR);
   g_eventLogger.enable(Logger::LL_ON, Logger::LL_WARNING);
diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp
index d6ed6c0dafd..f52233fc276 100644
--- a/ndb/src/kernel/vm/Emulator.cpp
+++ b/ndb/src/kernel/vm/Emulator.cpp
@@ -30,13 +30,15 @@
 #include <NodeState.hpp>
 
 #include <NdbMem.h>
-#include <NdbOut.hpp>
 #include <NdbMutex.h>
 #include <NdbSleep.h>
 
+#include <EventLogger.hpp>
+
 extern "C" {
   extern void (* ndb_new_handler)();
 }
+extern EventLogger g_eventLogger;
 
 /**
  * Declare the global variables 
@@ -141,23 +143,23 @@ NdbShutdown(NdbShutdownType type,
     
     switch(type){
     case NST_Normal:
-      ndbout << "Shutdown initiated" << endl;
+      g_eventLogger.info("Shutdown initiated");
       break;
     case NST_Watchdog:
-      ndbout << "Watchdog " << shutting << " system" << endl;
+      g_eventLogger.info("Watchdog %s system", shutting);
       break;
     case NST_ErrorHandler:
-      ndbout << "Error handler " << shutting << " system" << endl;
+      g_eventLogger.info("Error handler %s system", shutting);
       break;
     case NST_ErrorHandlerSignal:
-      ndbout << "Error handler signal " << shutting << " system" << endl;
+      g_eventLogger.info("Error handler signal %s system", shutting);
       break;
     case NST_Restart:
-      ndbout << "Restarting system" << endl;
+      g_eventLogger.info("Restarting system");
       break;
     default:
-      ndbout << "Error handler " << shutting << " system"
-	     << " (unknown type: " << (unsigned)type << ")" << endl;
+      g_eventLogger.info("Error handler %s system (unknown type: %u)",
+			 shutting, (unsigned)type);
       type = NST_ErrorHandler;
       break;
     }
@@ -173,7 +175,7 @@ NdbShutdown(NdbShutdownType type,
       /**
        * Very serious, don't attempt to free, just die!!
        */
-      ndbout << "Watchdog shutdown completed - " << exitAbort << endl;
+      g_eventLogger.info("Watchdog shutdown completed - %s", exitAbort);
 #if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
       signal(6, SIG_DFL);
       abort();
@@ -227,7 +229,7 @@ NdbShutdown(NdbShutdownType type,
     }
     
     if(type != NST_Normal && type != NST_Restart){
-      ndbout << "Error handler shutdown completed - " << exitAbort << endl;
+      g_eventLogger.info("Error handler shutdown completed - %s", exitAbort);
 #if ( defined VM_TRACE || defined ERROR_INSERT ) && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
       signal(6, SIG_DFL);
       abort();
@@ -243,7 +245,7 @@ NdbShutdown(NdbShutdownType type,
       exit(restartType);
     }
     
-    ndbout << "Shutdown completed - exiting" << endl;
+    g_eventLogger.info("Shutdown completed - exiting");
   } else {
     /**
      * Shutdown is already in progress
@@ -253,7 +255,7 @@ NdbShutdown(NdbShutdownType type,
      * If this is the watchdog, kill system the hard way
      */
     if (type== NST_Watchdog){
-      ndbout << "Watchdog is killing system the hard way" << endl;
+      g_eventLogger.info("Watchdog is killing system the hard way");
 #if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
       signal(6, SIG_DFL);
       abort();
-- 
2.30.9