ovs-monitor-ipsec: Convert to vlog.
authorEthan Jackson <ethan@nicira.com>
Sun, 25 Sep 2011 22:18:44 +0000 (15:18 -0700)
committerEthan Jackson <ethan@nicira.com>
Tue, 27 Sep 2011 21:51:49 +0000 (14:51 -0700)
debian/ovs-monitor-ipsec

index 0c1d6a87a044aeaacdada3eae0df22a67a0b1dc1..34b0866ff5f9e6e25a83f28f76a0435caefc7c7d 100644 (file)
@@ -27,8 +27,6 @@
 
 import argparse
 import glob
-import logging
-import logging.handlers
 import os
 import socket
 import subprocess
@@ -40,21 +38,9 @@ from ovs.db import types
 import ovs.util
 import ovs.daemon
 import ovs.db.idl
+import ovs.vlog
 
-s_log = logging.getLogger("ovs-monitor-ipsec")
-try:
-    # By default log messages as DAEMON into syslog
-    l_handler = logging.handlers.SysLogHandler(
-            "/dev/log",
-            facility=logging.handlers.SysLogHandler.LOG_DAEMON)
-    l_formatter = logging.Formatter('%(filename)s: %(levelname)s: %(message)s')
-    l_handler.setFormatter(l_formatter)
-    s_log.addHandler(l_handler)
-except socket.error, e:
-    logging.basicConfig()
-    s_log.warn("failed to connect to syslog (%s)" % e)
-s_log.addHandler(logging.StreamHandler())
-
+vlog = ovs.vlog.Vlog("ovs-monitor-ipsec")
 root_prefix = ''                # Prefix for absolute file names, for testing.
 setkey = "/usr/sbin/setkey"
 
@@ -444,8 +430,10 @@ def main():
                         help="Use DIR as alternate root directory"
                         " (for testing).")
 
+    ovs.vlog.add_args(parser)
     ovs.daemon.add_args(parser)
     args = parser.parse_args()
+    ovs.vlog.handle_args(args)
     ovs.daemon.handle_args(args)
 
     global root_prefix
@@ -518,5 +506,5 @@ if __name__ == '__main__':
         # Let system.exit() calls complete normally
         raise
     except:
-        s_log.exception("traceback")
+        vlog.exception("traceback")
         sys.exit(ovs.daemon.RESTART_EXIT_CODE)