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

Only log the error message in uptime monitor tasks #2181

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions care/facility/tasks/asset_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def check_asset_status():
)
else:
result = asset_class.api_get(asset_class.get_url("devices/status"))
except Exception:
logger.warn(f"Middleware {resolved_middleware} is down", exc_info=True)
except Exception as e:
logger.warn(f"Middleware {resolved_middleware} is down", e)

# If no status is returned, setting default status as down
if not result or "error" in result:
Expand Down Expand Up @@ -116,5 +116,5 @@ def check_asset_status():
status=new_status.value,
timestamp=status_record.get("time", timezone.now()),
)
except Exception:
logger.error("Error in Asset Status Check", exc_info=True)
except Exception as e:
logger.error("Error in Asset Status Check", e)
8 changes: 4 additions & 4 deletions care/facility/tasks/location_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def check_location_status():
if result:
new_status = AvailabilityStatus.OPERATIONAL

except Exception:
logger.warn(f"Middleware {resolved_middleware} is down", exc_info=True)
except Exception as e:
logger.warn(f"Middleware {resolved_middleware} is down", e)

# Fetching the last record of the location
last_record = (
Expand All @@ -75,5 +75,5 @@ def check_location_status():
timestamp=timezone.now(),
)
logger.info(f"Location {location.external_id} status: {new_status.value}")
except Exception:
logger.error("Error in Location Status Check", exc_info=True)
except Exception as e:
logger.error("Error in Location Status Check", e)
Loading