]> sourceware.org Git - systemtap.git/commitdiff
Include the date & time in all compile server log messages.
authorDave Brolley <brolley@redhat.com>
Thu, 12 May 2011 20:39:02 +0000 (16:39 -0400)
committerDave Brolley <brolley@redhat.com>
Thu, 12 May 2011 20:39:32 +0000 (16:39 -0400)
nsscommon.cxx
stap-serverd.cxx

index e9af4b3b439a90718a97e4af0b611f15e182f1fb..a8158cbbb9fb2205b5e13402abb91d222770d32f 100644 (file)
@@ -124,10 +124,17 @@ log_ok ()
 void
 log (const string &msg)
 {
+  // What time is it?
+  time_t now;
+  time (& now);
+  string nowStr = ctime (& now);
+  // Remove the newline from the end of the time string.
+  nowStr.erase (nowStr.size () - 1, 1);
+
   if (logfile.good ())
-    logfile << msg << endl << flush;
+    logfile << nowStr << ": " << msg << endl << flush;
   else
-    clog << msg << endl << flush;
+    clog << nowStr << ": " << msg << endl << flush;
 }
 
 void
@@ -1151,21 +1158,21 @@ cert_db_is_valid (const string &db_path, const string &nss_cert_name)
       CERTValidity &v = c->validity;
       char timeString[256];
       if (format_cert_validity_time (v.notBefore, timeString, sizeof (timeString)) == 0)
-       log (_F("  Not Valid Before: %s", timeString));
+       log (_F("  Not Valid Before: %s UTC", timeString));
       if (format_cert_validity_time (v.notAfter, timeString, sizeof (timeString)) == 0)
-       log (_F("  Not Valid After: %s", timeString));
+       log (_F("  Not Valid After: %s UTC", timeString));
 
       // Now ask NSS to check the validity.
       if (cert_is_valid (c))
        {
          // The cert is valid. One valid cert is enough.
-         log (_("  Certificate is valid"));
+         log (_("Certificate is valid"));
          valid_p = true;
          break;
        }
 
       // The cert is not valid. Look for another one.
-      log (_("  Certificate is not valid"));
+      log (_("Certificate is not valid"));
     }
   CERT_DestroyCertList (certs);
 
index 6a1bfd8e5ebb14c19edd5ebbf611f054e60d5339..5563fbb0a46c6ea229a7eaf083e6a71ba6eab630 100644 (file)
@@ -33,7 +33,6 @@ extern "C" {
 #include <fcntl.h>
 #include <sys/resource.h>
 #include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/utsname.h>
 
 #include <nspr.h>
@@ -591,7 +590,7 @@ initialize (int argc, char **argv) {
   parse_options (argc, argv);
 
   pid_t pid = getpid ();
-  log (_F("===== compile server pid %d starting", pid));
+  log (_F("===== compile server pid %d starting =====", pid));
 
   // Where is the ssl certificate/key database?
   if (cert_db_path.empty ())
@@ -1390,7 +1389,6 @@ accept_connections (PRFileDesc *listenSocket, CERTCertificate *cert)
   PRFileDesc *tcpSocket;
   SECStatus   secStatus;
   CERTCertDBHandle *dbHandle;
-  time_t      now;
 
   dbHandle = CERT_GetDefaultCertDB ();
 
@@ -1414,9 +1412,7 @@ accept_connections (PRFileDesc *listenSocket, CERTCertificate *cert)
        }
 
       /* Log the accepted connection.  */
-      time (& now);
-      log (_F("%sAccepted connection from %d.%d.%d.%d:%d",
-              ctime (& now),
+      log (_F("Accepted connection from %d.%d.%d.%d:%d",
              (addr.inet.ip      ) & 0xff,
              (addr.inet.ip >>  8) & 0xff,
              (addr.inet.ip >> 16) & 0xff,
@@ -1432,9 +1428,7 @@ accept_connections (PRFileDesc *listenSocket, CERTCertificate *cert)
        nsscommon_error (_("Error processing client request"));
 
       // Log the end of the request.
-      time (& now);
-      log (_F("%sRequest from %d.%d.%d.%d:%d complete",
-              ctime (& now),
+      log (_F("Request from %d.%d.%d.%d:%d complete",
              (addr.inet.ip      ) & 0xff,
              (addr.inet.ip >>  8) & 0xff,
              (addr.inet.ip >> 16) & 0xff,
This page took 0.034588 seconds and 5 git commands to generate.