[Yum] [python API] logging

Alon Bar-Lev alonbl at redhat.com
Wed Sep 12 19:40:15 UTC 2012


Hello All,

I am trying to use yum via python.

It is great apart of one issue I would like to discuss - logging.

Going over the sources I see a lot of logs.

At least:

'yum', 'yum.Depsolve', 'yum.RepoStorage', 'yum.Repos',
'yum.YumBase', 'yum.filelogging', 'yum.filelogging.RPMInstallCallback'
'yum.plugin', 'yum.verbose',
'yum.verbose.Depsolve',
'yum.verbose.ProcessTrasactionBaseCallback', 'yum.verbose.Repos',
'yum.verbose.YumPlugins', 'yum.verbose.plugin',
'yum.verbose.YumBase'

Having so much logs is great, however the yum implementation lazy initialize the logs as objects are constructed. This override any setting I may have for these logs. Especially the stdout, stderr setting.

My mission is to use yum pragmatically an write my own logging, thus writing even a single message to stdout/stderr breaks the entire application.

Another issue is the large number of logs - as in python the log must be explicitly initialized, meaning it is not enough to initialize the 'yum' log to have effect on all the other logs.
So even if explicit logs are properly initialize as application evolves it can add new logs, which will break the application.

What I suggest is to add a logging object that will initialize all logging for the application at yumbase constructor, then user may override the settings as desired.

The logging object will also hold a list of all available logs, so implementation can know what logs are available for configuration.

Maybe I missed some feature within the library... I will be happy to know.

Thoughts?
Alon.


More information about the Yum mailing list