Bug 1327942

Summary: Trace logging does not work for vdsm.
Product: Red Hat Enterprise Virtualization Manager Reporter: Roman Hodain <rhodain>
Component: vdsmAssignee: Yaniv Bronhaim <ybronhei>
Status: CLOSED NOTABUG QA Contact: Aharon Canan <acanan>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.6.4CC: bazulay, gklein, lsurette, mkalinin, oourfali, rhodain, ybronhei, ycui, yeylon, ykaul
Target Milestone: ovirt-4.0.0-rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-01 14:04:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Roman Hodain 2016-04-18 05:24:25 UTC
Description of problem:
Vdsm defines its own Trace level logging. This level is defined to late and causes vdsm fail when TRACE level is configured in logger.conf

Version-Release number of selected component (if applicable):
     vdsm-4.17.23.2-1.el7ev.noarch

How reproducible:
     100%

Steps to Reproduce:
     1. Set Trace log level for one of the loggers in  /etc/vdsm/logger.conf
     2. Restart vdsmd

Actual results:
     Vdsm does not sstart

Expected results:
     Vdsm starts and logs in trace log level

Comment 2 Yaniv Lavi 2016-05-09 10:57:59 UTC
oVirt 4.0 Alpha has been released, moving to oVirt 4.0 Beta target.

Comment 5 Oved Ourfali 2016-05-25 14:25:27 UTC
Yaniv - can you take a look?

Comment 6 Yaniv Bronhaim 2016-05-29 14:38:08 UTC
there is not TRACE log level in logging module:

-sh-4.2$ ./vdsm
Traceback (most recent call last):
  File "./vdsm", line 261, in <module>
    main()
  File "./vdsm", line 256, in main
    run()
  File "./vdsm", line 125, in run
    lconfig.fileConfig(loggerConfFile, disable_existing_loggers=False)
  File "/usr/lib64/python2.7/logging/config.py", line 79, in fileConfig
    _install_loggers(cp, handlers, disable_existing_loggers)
  File "/usr/lib64/python2.7/logging/config.py", line 190, in _install_loggers
    log.setLevel(logging._levelNames[level])
KeyError: 'TRACE'

that's why it doesn't start for you - see https://docs.python.org/2/library/logging.html#logging-levels

I'm not so sure why we do
129     logging.addLevelName(5, 'TRACE')                                             
130     logging.TRACE = 5  # impolite but helpful

but its being used rarely in some places using logging.TRACE after we add it to logging. 
so you can't define log level TRACE using the conf file. and anyway, the value we give to it (5) is lower than DEBUG, it looks redundant code to me.

let me know if I miss something ..