[Wok][RFC] Option to specific logging levels #35

Propose: support different levels of logging on wok Bug: wok is setting logging handlers only, not cherrypy handlers. Issues: After my troubleshooting, just saw that we need to set cherrypy handlers: --- a/src/wok/server.py +++ b/src/wok/server.py @@ -120,6 +120,7 @@ class Server(object): delay=1) h.setLevel(logLevel) h.setFormatter(cherrypy._cplogging.logfmt) + cherrypy.log.access_log.setLevel(logLevel) # Add access log file to cherrypy configuration cherrypy.log.access_log.addHandler(h) @@ -128,6 +129,7 @@ class Server(object): h = SafeWatchedFileHandler(options.error_log, 'a', delay=1) h.setLevel(logLevel) h.setFormatter(cherrypy._cplogging.logfmt) + cherrypy.log.error_log.setLevel(logLevel) # Add error log file to cherrypy configuration cherrypy.log.error_log.addHandler(h) When testing, got this output: Running with loglevel == debug command-line ./src/wokd: No output access_log: lot of output, info output and commands results error_log: debug info ------------------------ Running with loglevel == info command-line ./src/wokd: No output access_log: lot of output, info output error_log: info -------------------------------- Running with loglevel == error command-line ./src/wokd: Info output (no expected) access_log: just calls to the urls error_log: only error The last one was not expected :( -- Ramon Nunes Medeiros Kimchi Developer Linux Technology Center Brazil IBM Systems & Technology Group Phone : +55 19 2132 7878 ramonn@br.ibm.com

Hi Ramon, On 01/19/2017 04:28 PM, Ramon Medeiros wrote:
Propose: support different levels of logging on wok
Bug: wok is setting logging handlers only, not cherrypy handlers.
Issues: After my troubleshooting, just saw that we need to set cherrypy handlers: --- a/src/wok/server.py +++ b/src/wok/server.py @@ -120,6 +120,7 @@ class Server(object): delay=1) h.setLevel(logLevel) h.setFormatter(cherrypy._cplogging.logfmt) + cherrypy.log.access_log.setLevel(logLevel)
# Add access log file to cherrypy configuration cherrypy.log.access_log.addHandler(h) @@ -128,6 +129,7 @@ class Server(object): h = SafeWatchedFileHandler(options.error_log, 'a', delay=1) h.setLevel(logLevel) h.setFormatter(cherrypy._cplogging.logfmt) + cherrypy.log.error_log.setLevel(logLevel)
# Add error log file to cherrypy configuration cherrypy.log.error_log.addHandler(h)
When testing, got this output:
Running with loglevel == debug command-line ./src/wokd: No output
access_log: lot of output, info output and commands results
error_log: debug info
------------------------
Running with loglevel == info command-line ./src/wokd: No output
access_log: lot of output, info output
error_log: info
--------------------------------
Running with loglevel == error command-line ./src/wokd: Info output (no expected)
access_log: just calls to the urls
error_log: only error
The last one was not expected :(
I am not sure what was not expected. Could you clarify?
--
Ramon Nunes Medeiros Kimchi Developer Linux Technology Center Brazil IBM Systems & Technology Group Phone : +55 19 2132 7878 ramonn@br.ibm.com
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

On 1/24/17 10:32 AM, Aline Manera wrote:
Hi Ramon,
On 01/19/2017 04:28 PM, Ramon Medeiros wrote:
Propose: support different levels of logging on wok
Bug: wok is setting logging handlers only, not cherrypy handlers.
Issues: After my troubleshooting, just saw that we need to set cherrypy handlers: --- a/src/wok/server.py +++ b/src/wok/server.py @@ -120,6 +120,7 @@ class Server(object): delay=1) h.setLevel(logLevel) h.setFormatter(cherrypy._cplogging.logfmt) + cherrypy.log.access_log.setLevel(logLevel)
# Add access log file to cherrypy configuration cherrypy.log.access_log.addHandler(h) @@ -128,6 +129,7 @@ class Server(object): h = SafeWatchedFileHandler(options.error_log, 'a', delay=1) h.setLevel(logLevel) h.setFormatter(cherrypy._cplogging.logfmt) + cherrypy.log.error_log.setLevel(logLevel)
# Add error log file to cherrypy configuration cherrypy.log.error_log.addHandler(h)
When testing, got this output:
Running with loglevel == debug command-line ./src/wokd: No output
access_log: lot of output, info output and commands results
error_log: debug info
------------------------
Running with loglevel == info command-line ./src/wokd: No output
access_log: lot of output, info output
error_log: info
--------------------------------
Running with loglevel == error command-line ./src/wokd: Info output (no expected)
access_log: just calls to the urls
error_log: only error
The last one was not expected :(
I am not sure what was not expected. Could you clarify?
was not expected to see INFO log when setting to error level.
--
Ramon Nunes Medeiros Kimchi Developer Linux Technology Center Brazil IBM Systems & Technology Group Phone : +55 19 2132 7878 ramonn@br.ibm.com
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

On 01/27/2017 04:02 PM, Ramon Medeiros wrote:
On 1/24/17 10:32 AM, Aline Manera wrote:
Hi Ramon,
On 01/19/2017 04:28 PM, Ramon Medeiros wrote:
Propose: support different levels of logging on wok
Bug: wok is setting logging handlers only, not cherrypy handlers.
Issues: After my troubleshooting, just saw that we need to set cherrypy handlers: --- a/src/wok/server.py +++ b/src/wok/server.py @@ -120,6 +120,7 @@ class Server(object): delay=1) h.setLevel(logLevel) h.setFormatter(cherrypy._cplogging.logfmt) + cherrypy.log.access_log.setLevel(logLevel)
# Add access log file to cherrypy configuration cherrypy.log.access_log.addHandler(h) @@ -128,6 +129,7 @@ class Server(object): h = SafeWatchedFileHandler(options.error_log, 'a', delay=1) h.setLevel(logLevel) h.setFormatter(cherrypy._cplogging.logfmt) + cherrypy.log.error_log.setLevel(logLevel)
# Add error log file to cherrypy configuration cherrypy.log.error_log.addHandler(h)
When testing, got this output:
Running with loglevel == debug command-line ./src/wokd: No output
access_log: lot of output, info output and commands results
error_log: debug info
------------------------
Running with loglevel == info command-line ./src/wokd: No output
access_log: lot of output, info output
error_log: info
--------------------------------
Running with loglevel == error command-line ./src/wokd: Info output (no expected)
access_log: just calls to the urls
error_log: only error
The last one was not expected :(
I am not sure what was not expected. Could you clarify?
was not expected to see INFO log when setting to error level.
I am not sure if the command output should be consider as a log. From my view, the right content should be in the log files. The command line output should be enabled only when running with environment != production to make debug easier. You can check src/wok/server.py to check that: # Enable cherrypy screen logging if running environment # is not 'production' if dev_env: cherrypy.log.screen = True When running on production (the default mode), the command line output is not even shown.
--
Ramon Nunes Medeiros Kimchi Developer Linux Technology Center Brazil IBM Systems & Technology Group Phone : +55 19 2132 7878 ramonn@br.ibm.com
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (2)
-
Aline Manera
-
Ramon Medeiros