Skip to content

Commit

Permalink
use logger.debug for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
rpitonak committed Oct 17, 2018
1 parent 8a86f22 commit d8d35ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions conu/backend/k8s/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ def get_logs(self):
"""
try:
api_response = self.core_api.read_namespaced_pod_log(self.name, self.namespace)
logger.info("Logs from pod: %s in namespace: %s", self.name, self.namespace)
logger.debug("Logs from pod: %s in namespace: %s", self.name, self.namespace)
for line in api_response.split('\n'):
logger.info(line)
logger.debug(line)
return api_response
except ApiException as e:
# no reason to throw exception when logs cannot be obtain, just notify user
logger.info("Cannot get pod logs because of "
"exception during calling Kubernetes API %s\n", e)
logger.debug("Cannot get pod logs because of "
"exception during calling Kubernetes API %s\n", e)

return None

Expand Down
7 changes: 4 additions & 3 deletions conu/backend/origin/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,16 @@ def get_status(self):
c = self._oc_command(["status"])
o = run_cmd(c, return_output=True)
for line in o.split('\n'):
logger.info(line)
logger.debug(line)
return o
except subprocess.CalledProcessError as ex:
raise ConuException("Cannot obtain OpenShift cluster status: %s" % ex)

def get_logs(self, name):
"""
Get logs from all pods
:param name: str, name of app
Obtain cluster status and logs from all pods and print them using logger.
This method is useful for debugging.
:param name: str, name of app generated by oc new-app
:return: str, cluster status and logs from all pods
"""
logs = self.get_status()
Expand Down

0 comments on commit d8d35ca

Please sign in to comment.