Change in vdsm[master]: Logging: config logging in new process of remoteFileHandler

zhshzhou at linux.vnet.ibm.com zhshzhou at linux.vnet.ibm.com
Tue Nov 13 01:53:18 UTC 2012


Zhou Zheng Sheng has posted comments on this change.

Change subject: Logging: config logging in new process of remoteFileHandler
......................................................................


Patch Set 1: (1 inline comment)

Thanks ShaoHe.

....................................................
File vdsm/storage/remoteFileHandler.py
Line 36: 
Line 37: if __name__ == "__main__":
Line 38:     from logging import config as lconfig
Line 39:     loggerConfFile = constants.P_VDSM_CONF + 'logger.conf'
Line 40:     lconfig.fileConfig(loggerConfFile)
It's OK to put these pieces to line 385. However I think there are some the modules directly or indirectly imported by remoteFileHandler, they could write logs during the module initialization, and I do not want to lose these logs, so I put these pieces before any imports of modules in VDSM. You could take a look at vdsm/vdsm, the vdsm main module. It initializes the log config in function run(), then calls serve_clients(), and imports clientIF in serve_clients(). That means the main process of VDSM configs the log before it imports any modules in VDSM (except vdsm.constants).

remoteFileHandler is a module both for being imported by other modules and for starting a new process, so we can not move all the import statements in this file under the standalone main entry just like vdsm/vdsm does. So I let it config the log before any imports when __name == "__main__".

I can add a comment in the code to explain that.
Line 41: 
Line 42: import misc
Line 43: import fileUtils
Line 44: 


--
To view, visit http://gerrit.ovirt.org/9182
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1b3b9e2837d632c7532fcd8f7306ed50b0865b5c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Gerrit-Reviewer: Mark Wu <wudxw at linux.vnet.ibm.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>


More information about the vdsm-patches mailing list