Skip to content

Commit 9a7a6c2

Browse files
DPE-7726: Log Patroni start/stop/restart (to undestand charm behavior)
1 parent d2388a9 commit 9a7a6c2

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
@@ -781,6 +781,7 @@ def start_patroni(self) -> bool:
781781
Whether the service started successfully.
782782
"""
783783
try:
784+
logger.debug("Starting Patroni...")
784785
cache = snap.SnapCache()
785786
selected_snap = cache["charmed-postgresql"]
786787
selected_snap.start(services=["patroni"])
@@ -800,6 +801,7 @@ def patroni_logs(self, num_lines: int | str | None = 10) -> str:
800801
Multi-line logs string.
801802
"""
802803
try:
804+
logger.debug("Getting Patroni logs...")
803805
cache = snap.SnapCache()
804806
selected_snap = cache["charmed-postgresql"]
805807
# Lib definition of num_lines only allows int
@@ -836,6 +838,7 @@ def stop_patroni(self) -> bool:
836838
Whether the service stopped successfully.
837839
"""
838840
try:
841+
logger.debug("Stopping Patroni...")
839842
cache = snap.SnapCache()
840843
selected_snap = cache["charmed-postgresql"]
841844
selected_snap.stop(services=["patroni"])
@@ -1054,6 +1057,7 @@ def restart_patroni(self) -> bool:
10541057
Whether the service restarted successfully.
10551058
"""
10561059
try:
1060+
logger.debug("Restarting Patroni...")
10571061
cache = snap.SnapCache()
10581062
selected_snap = cache["charmed-postgresql"]
10591063
selected_snap.restart(services=["patroni"])

0 commit comments

Comments
 (0)