Skip to content

Commit cc4e49c

Browse files
DPE-7726: Log Patroni start/stop/restart (to undestand charm behavior)
1 parent 20a9a2e commit cc4e49c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cluster.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ def start_patroni(self) -> bool:
783783
Whether the service started successfully.
784784
"""
785785
try:
786+
logger.debug("Starting Patroni...")
786787
cache = snap.SnapCache()
787788
selected_snap = cache["charmed-postgresql"]
788789
selected_snap.start(services=["patroni"])
@@ -802,6 +803,7 @@ def patroni_logs(self, num_lines: int | str | None = 10) -> str:
802803
Multi-line logs string.
803804
"""
804805
try:
806+
logger.debug("Getting Patroni logs...")
805807
cache = snap.SnapCache()
806808
selected_snap = cache["charmed-postgresql"]
807809
# Lib definition of num_lines only allows int
@@ -838,6 +840,7 @@ def stop_patroni(self) -> bool:
838840
Whether the service stopped successfully.
839841
"""
840842
try:
843+
logger.debug("Stopping Patroni...")
841844
cache = snap.SnapCache()
842845
selected_snap = cache["charmed-postgresql"]
843846
selected_snap.stop(services=["patroni"])
@@ -1056,6 +1059,7 @@ def restart_patroni(self) -> bool:
10561059
Whether the service restarted successfully.
10571060
"""
10581061
try:
1062+
logger.debug("Restarting Patroni...")
10591063
cache = snap.SnapCache()
10601064
selected_snap = cache["charmed-postgresql"]
10611065
selected_snap.restart(services=["patroni"])

0 commit comments

Comments
 (0)