Skip to content

Commit

Permalink
Merge pull request #8 from javacruft/feat/log-to-console
Browse files Browse the repository at this point in the history
logging: log to console
  • Loading branch information
Liam Young authored Sep 7, 2023
2 parents 0aa1a62 + acf91f9 commit 0de4881
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,18 @@ def _check_rmq_running():

def _rabbitmq_layer(self) -> dict:
"""Pebble layer definition for RabbitMQ."""
# NOTE(jamespage)
# Use the full path to the rabbitmq-server binary
# rather than the helper wrapper script to avoid
# redirection of console output to a log file.
return {
"summary": "RabbitMQ layer",
"description": "pebble config layer for RabbitMQ",
"services": {
RABBITMQ_SERVICE: {
"override": "replace",
"summary": "RabbitMQ Server",
"command": "rabbitmq-server",
"command": "/usr/lib/rabbitmq/bin/rabbitmq-server",
"startup": "enabled",
"user": RABBITMQ_USER,
"group": RABBITMQ_GROUP,
Expand Down Expand Up @@ -744,6 +748,10 @@ def _render_and_push_rabbitmq_conf(self) -> None:
cluster_partition_handling = autoheal
queue_master_locator = min-masters
# Log to console for pod logging
log.console = true
log.file = false
"""
logger.info("Pushing new rabbitmq.conf")
container.push(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_rabbitmq_pebble_ready(self):
"rabbitmq": {
"override": "replace",
"summary": "RabbitMQ Server",
"command": "rabbitmq-server",
"command": "/usr/lib/rabbitmq/bin/rabbitmq-server",
"startup": "enabled",
"user": "rabbitmq",
"group": "rabbitmq",
Expand Down

0 comments on commit 0de4881

Please sign in to comment.