[Kimchi-devel] [PATCH] [Wok 7/7] Change location of User Requests Log
Lucio Correia
luciojhc at linux.vnet.ibm.com
Wed Aug 31 18:10:16 UTC 2016
That log file is not intended anymore to be a log file
itself.
Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
---
src/wok/config.py.in | 4 ++++
src/wok/reqlogger.py | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/wok/config.py.in b/src/wok/config.py.in
index cbe585c..f82aa0a 100644
--- a/src/wok/config.py.in
+++ b/src/wok/config.py.in
@@ -66,6 +66,10 @@ def get_object_store():
return os.path.join(paths.state_dir, 'objectstore')
+def get_data_dir():
+ return paths.state_dir
+
+
def get_version():
return "-".join([__version__, __release__])
diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
index 7a95907..92eff83 100644
--- a/src/wok/reqlogger.py
+++ b/src/wok/reqlogger.py
@@ -29,7 +29,7 @@ import uuid
from cherrypy.process.plugins import BackgroundTask
from tempfile import NamedTemporaryFile
-from wok.config import config, get_log_download_path
+from wok.config import get_data_dir, get_log_download_path
from wok.exception import InvalidParameter, OperationFailed
from wok.message import WokMessage
from wok.stringutils import ascii_dict
@@ -60,7 +60,7 @@ TS_ZONE_FORMAT = "%Z"
UNSAFE_REQUEST_PARAMETERS = ['password', 'passwd']
# Log handler setup
-REQUEST_LOG_FILE = "wok-req.log"
+REQUEST_LOG_FILE = "user-requests.data"
WOK_REQUEST_LOGGER = "wok_request_logger"
# AsyncTask handling
@@ -69,7 +69,7 @@ ASYNCTASK_REQUEST_METHOD = 'TASK'
class RequestLogger(object):
def __init__(self):
- log = os.path.join(config.get("logging", "log_dir"), REQUEST_LOG_FILE)
+ log = os.path.join(get_data_dir(), REQUEST_LOG_FILE)
h = logging.handlers.WatchedFileHandler(log, 'a')
h.setFormatter(logging.Formatter('%(message)s'))
self.handler = h
--
1.9.1
More information about the Kimchi-devel
mailing list