Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdsm-tool: move logs from stdout print to logging #258

Open
aesteve-rh opened this issue Jun 20, 2022 · 0 comments
Open

vdsm-tool: move logs from stdout print to logging #258

aesteve-rh opened this issue Jun 20, 2022 · 0 comments
Labels
enhancement Enhancing the system by adding new feature or improving performance or reliability logs Enhancement or fixes to logs

Comments

@aesteve-rh
Copy link
Member

Currently, vdsm-tool logs messages directly to the stdout using the sys module. However, this solution is very limiting:

  • Don't have severity levels, which limit control over what messages are printed, and make the programmer responsible for manually adding the severity in the message.
  • Don't have unified formatter. Messages can have inconsistent formats and lack information.
  • Messages are always printed from the vdsm-tool modules. For parts where the vdsm-tool acts as a wrapper for another vdsm module, any internal logging the vdsm module might do must be deferred to the vdsm-tool. Alternatively, with logging we can pass the object as a parameter to allow other modules to log messages directly to the vdsm-tool output, with consistent formatting.

Proposal

Use logging, instantiate it in the __init__ module and set up a format. From there we can import it in all submodules and use it instead of sys.stdout, with the proper severity level, and give it as parameter in wrapper modules.

@aesteve-rh aesteve-rh added enhancement Enhancing the system by adding new feature or improving performance or reliability logs Enhancement or fixes to logs labels Jun 20, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Sep 1, 2022
Use the global logger stored in
vdsm.tool.LOGGER_NAME from all vdsm-tool
sub-modules. All logs will use standard
logging with consistent formatting.

Fixes: oVirt#258
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Sep 1, 2022
Use the global logger stored in
vdsm.tool.LOGGER_NAME from all vdsm-tool
sub-modules. All logs will use standard
logging with consistent formatting.

Fixes: oVirt#258
Signed-off-by: Albert Esteve <[email protected]>
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Sep 1, 2022
Use the global logger stored in
vdsm.tool.LOGGER_NAME from all vdsm-tool
sub-modules. All logs will use standard
logging with consistent formatting.

Fixes: oVirt#258
Signed-off-by: Albert Esteve <[email protected]>
@aesteve-rh aesteve-rh self-assigned this Sep 23, 2022
aesteve-rh added a commit to aesteve-rh/vdsm that referenced this issue Oct 17, 2022
Use the global logger stored in
vdsm.tool.LOGGER_NAME from all vdsm-tool
sub-modules. All logs will use standard
logging with consistent formatting.

Fixes: oVirt#258
Signed-off-by: Albert Esteve <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancing the system by adding new feature or improving performance or reliability logs Enhancement or fixes to logs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant