[ovs-dev] [PATCH] Python daemons: Changed log date time format.

Arun Sharma arun.sharma at calsoftinc.com
Mon Jul 2 11:32:44 UTC 2012


Changed the python daemons log date and time format to keep similar
as C binaries logging format. The date time is in UTC.

Signed-off-by: Arun Sharma <arun.sharma at calsoftinc.com>
---
 python/ovs/vlog.py |    2 +-
 tests/vlog.at      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/ovs/vlog.py b/python/ovs/vlog.py
index ed95012..f7ace66 100644
--- a/python/ovs/vlog.py
+++ b/python/ovs/vlog.py
@@ -60,7 +60,7 @@ class Vlog:
         if not Vlog.__inited:
             return
 
-        now = datetime.datetime.now().strftime("%b %d %H:%M:%S")
+        now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
         message = ("%s|%s|%s|%s|%s"
                    % (now, Vlog.__msg_num, self.name, level, message))
 
diff --git a/tests/vlog.at b/tests/vlog.at
index 27ec79e..2bc7b5c 100644
--- a/tests/vlog.at
+++ b/tests/vlog.at
@@ -9,7 +9,7 @@ AT_CHECK([$PYTHON $srcdir/test-vlog.py --log-file log_file \
 
 AT_CHECK([diff log_file stderr_log])
 
-AT_CHECK([sed -e 's/.* .* ..:..:..|//' \
+AT_CHECK([sed -e 's/.*-.*-.*T..:..:..Z|//' \
 -e 's/File ".*", line [[0-9]][[0-9]]*,/File <name>, line <number>,/' \
 stderr_log], [0], [dnl
 0|module_0|EMER|emergency
-- 
1.7.2.5




More information about the dev mailing list