2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-27 15:18:06 +00:00

vlog: Add vlog/close command.

Requested-by: P R Dinesh
Requested-at: https://github.com/openvswitch/ovs/pull/94
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
This commit is contained in:
Ben Pfaff
2016-02-03 13:41:34 -08:00
parent 922fed065e
commit 063801288e
7 changed files with 125 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
# Copyright (c) 2011, 2012, 2013 Nicira, Inc.
# Copyright (c) 2011, 2012, 2013, 2015, 2016 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -241,6 +241,8 @@ class Vlog(object):
ovs.unixctl.command_register("vlog/reopen", "", 0, 0,
Vlog._unixctl_vlog_reopen, None)
ovs.unixctl.command_register("vlog/close", "", 0, 0,
Vlog._unixctl_vlog_close, None)
ovs.unixctl.command_register("vlog/set", "spec", 1, sys.maxsize,
Vlog._unixctl_vlog_set, None)
ovs.unixctl.command_register("vlog/list", "", 0, 0,
@@ -389,6 +391,13 @@ class Vlog(object):
else:
conn.reply("Logging to file not configured")
@staticmethod
def _unixctl_vlog_close(conn, unused_argv, unused_aux):
if Vlog.__log_file:
logger = logging.getLogger("file")
logger.removeHandler(Vlog.__file_handler)
conn.reply(None)
@staticmethod
def _unixctl_vlog_set(conn, argv, unused_aux):
for arg in argv: