Adjust io-level logging in gerrit/git drivers

Currently the logging for polling is verbose.  Adjust it as follows:

* In the git driver, don't list every ref we see, just log the count
  so we know it's working.
* In the gerrit driver, move logging of some HTTP traffic to the
  "io" logger.
* In the default logging configuration for the server, if the '-d'
  option is given, do not include "io" logging.  The only way to
  get this extremely verbose data is now with a custom logging
  config.

Change-Id: If0d5877f65296ee2a9f7f0298f8bc6664e6c2a4c
This commit is contained in:
James E. Blair 2020-02-13 13:25:44 -08:00
parent d1b95639b9
commit 1e04bdb4aa
3 changed files with 8 additions and 3 deletions

View File

@ -90,6 +90,10 @@ _DEFAULT_SERVER_LOGGING_CONFIG = {
'handlers': ['console'],
'level': 'INFO',
},
'zuul.GerritConnection.io': {
'handlers': ['console'],
'level': 'WARN',
},
'sqlalchemy.engine': {
'handlers': ['console'],
'level': 'WARN',

View File

@ -612,7 +612,7 @@ class GerritConnection(BaseConnection):
verify=self.verify_ssl,
auth=self.auth, timeout=TIMEOUT,
headers={'User-Agent': self.user_agent})
self.log.debug('Received: %s %s' % (r.status_code, r.text,))
self.iolog.debug('Received: %s %s' % (r.status_code, r.text,))
if r.status_code != 200:
raise Exception("Received response %s" % (r.status_code,))
ret = None
@ -636,7 +636,7 @@ class GerritConnection(BaseConnection):
auth=self.auth, timeout=TIMEOUT,
headers={'Content-Type': 'application/json;charset=UTF-8',
'User-Agent': self.user_agent})
self.log.debug('Received: %s %s' % (r.status_code, r.text,))
self.iolog.debug('Received: %s %s' % (r.status_code, r.text,))
if r.status_code != 200:
raise Exception("Received response %s" % (r.status_code,))
ret = None

View File

@ -116,7 +116,8 @@ class GitWatcher(threading.Thread):
try:
for project in self.connection.projects:
refs = self.lsRemote(project)
self.log.debug("Read refs %s for project %s" % (refs, project))
self.log.debug("Read %s refs for project %s",
len(refs), project)
if not self.projects_refs.get(project):
# State for this project does not exist yet so add it.
# No event will be triggered in this loop as