[Kimchi-devel] [Wok][RFC] Option to specific logging levels #35

Aline Manera alinefm at linux.vnet.ibm.com
Mon Jan 30 16:39:02 UTC 2017



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 at br.ibm.com  
>>>
>>>
>>> _______________________________________________
>>> Kimchi-devel mailing list
>>> Kimchi-devel at ovirt.org
>>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20170130/4a428dc5/attachment.html>


More information about the Kimchi-devel mailing list