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

qgs: add --verbose & --debug parameters to control logging #428

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

berrange
Copy link

@berrange berrange commented Oct 4, 2024

The interesting stuff is in the third commit...

Currently qgs prints all log messages to syslog or stderr unconditionally, even those at QGS_LOG_LEVEL_INFO. At the same time it hardcodes SGX_QL_LOG_ERROR for the quote provider library making it impossible to debug that part of the code.

This adds --verbose and --debug parameters to QGS with the following behaviour

  • Messages from QGS code at QGS_LOG_LEVEL_INFO are discarded unless --verbose is set. This makes QGS quiet by default, only printing warnings/errors.
  • Messages from the quote provider library are requested at SGX_QL_LOG_INFO instead of SGX_QL_LOG_ERROR if --debug
    is set. This output is very volumous, dumping HTTP request and response info, hence putting it behind --debug, instead of enabling it with the former --verbose flag.
  • Enabling --debug will imply --verbose, so setting both is redundant, albeit harmless

The first two commits just fix two tiny bugs

The sgx_proc_log_report() method takes a format string and
var-args. It is unsafe to accept a non-const string from
the QL library and pass it to sgx_proc_log_report(), as the
log message may contain format strings from user data.

Signed-off-by: Daniel P. Berrangé <[email protected]>
Currently qgs prints all log messages to syslog or stderr
unconditionally, even those at QGS_LOG_LEVEL_INFO. At the
same time it hardcodes SGX_QL_LOG_ERROR for the quote
provider library making it impossible to debug that part
of the code.

This adds --verbose and --debug parameters to QGS with the
following behaviour

 * Messages from QGS code at QGS_LOG_LEVEL_INFO are discarded
   unless --verbose is set. This makes QGS quiet by default,
   only printing warnings/errors.

 * Messages from the quote provider library are requested at
   SGX_QL_LOG_INFO instead of SGX_QL_LOG_ERROR if --debug
   is set. This output is very volumous, dumping HTTP request
   and response info, hence putting it behind --debug, instead
   of enabling it with the former --verbose flag.

 * Enabling --debug will imply --verbose, so setting both is
   redundant, albeit harmless

Signed-off-by: Daniel P. Berrangé <[email protected]>
@haitaohuang haitaohuang requested review from llly, fqiu1 and jdbeaney October 9, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant