On 26-02-2016 10:40, Aline Manera wrote:
> diff --git a/src/wok/server.py b/src/wok/server.py
> index 75b41d5..e27124e 100644
> --- a/src/wok/server.py
> +++ b/src/wok/server.py
> @@ -36,6 +36,7 @@ from wok.model import model
> from wok.proxy import start_proxy, terminate_proxy
> from wok.root import WokRoot
> from wok.safewatchedfilehandler import SafeWatchedFileHandler
> +from wok.reqlogger import MAX_FILE_SIZE, NUM_BACKUP_FILES,
> WOK_REQUEST_LOGGER
> from wok.utils import get_enabled_plugins, import_class
>
> LOGGING_LEVEL = {"debug": logging.DEBUG,
> @@ -65,6 +66,7 @@ class Server(object):
> start_proxy(options)
>
> make_dirs = [
> + os.path.abspath(config.get_log_download_path()),
> os.path.dirname(os.path.abspath(options.access_log)),
> os.path.dirname(os.path.abspath(options.error_log)),
> os.path.dirname(os.path.abspath(config.get_object_store()))
> @@ -130,6 +132,15 @@ class Server(object):
> # Add error log file to cherrypy configuration
> cherrypy.log.error_log.addHandler(h)
> + # Request logger setup
> + h = logging.handlers.RotatingFileHandler(options.req_log, 'a',
> + maxBytes=MAX_FILE_SIZE,
> +
> backupCount=NUM_BACKUP_FILES)
> + h.setFormatter(logging.Formatter('%(message)s'))
> + reqLogger = logging.getLogger(WOK_REQUEST_LOGGER)
> + reqLogger.setLevel(logging.INFO)
> + reqLogger.addHandler(h)
> +
There was a recent change on wok to use a thread safe logging (commit
3aad7ba93d0228650af8c95101addd561140cef7)
Maybe it will be better to use it in this case too.
Ziviani, as you did the patch about the logging, could you advice on that?
That one uses WatchedFileHandler, not RotatingFileHandler I've used.
What can be done is to make a SafeRotatingFileHandler similar to the
SafeWatchedFileHandler made by Ziviani. Does it make sense?
--
Lucio Correia
Software Engineer
IBM LTC Brazil