integ/base/cluster-resource-agents/centos/patches/Do-not-log-at-debug-log-level-when-HA_debug-is-unset.patch
Joao Paulo Tavares Musico ed307f794a Reduce log rates for daemon-ocf
A 3 year old patch which made debug log default to off has been
missed. This change will add this patch so log rates for
daemon-ocf.log will decrease.
To turn on debug logging a variable shall be added for each process:
i.e. keystone
Add following like to /use/lib/ocf/resource.d/openstack/keystone
HA_debug=1

Test Plan:

PASS: Verify that by default no more debug logs are found in
daemon-ocf.log
PASS: Verify that adding HA_debug=1 to an ocf script will enable debug
logging for that process
PASS: Verify that having HA_debug=0 to an ocf script will disable
debug logging for that process

Failure Path:

PASS: Verify a value other than 0 or 1 for HA_debug will not break
process

Regression:

PASS: Verify system install
PASS: Verify all log levels, other than debug, are still being
generated

Story: 2009272
Task: 43606

Signed-off-by: Joao Paulo Tavares Musico <joaopaulotavares.musico@windriver.com>
Change-Id: Icfc62d0e7eafaaedfd0fe516f8c1b137343f8428
2021-10-25 19:21:26 +00:00

36 lines
1.1 KiB
Diff

From aae26ca70ef910e83485778c1fb450941fe79e8a Mon Sep 17 00:00:00 2001
From: Michele Baldessari <michele@acksyn.org>
Date: Mon, 3 Dec 2018 16:48:14 +0100
Subject: [PATCH] Do not log at debug log level when HA_debug is unset
There might be situations (e.g. bundles) where the HA_debug variable
is unset. It makes little sense to enable debug logging when the HA_debug env
variable is unset.
So let's skip debug logs when HA_debug is set to 0 or is unset.
Tested inside a bundle and observed that previously seen 'ocf_log debug'
calls are now correctly suppressed (w/ HA_debug being unset inside the
container)
Signed-off-by: Michele Baldessari <michele@acksyn.org>
---
heartbeat/ocf-shellfuncs.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
index 043ab9bf..b17297e1 100644
--- a/heartbeat/ocf-shellfuncs.in
+++ b/heartbeat/ocf-shellfuncs.in
@@ -257,7 +257,7 @@ ha_log()
ha_debug() {
- if [ "x${HA_debug}" = "x0" ] ; then
+ if [ "x${HA_debug}" = "x0" ] || [ -z "${HA_debug}" ] ; then
return 0
fi
if tty >/dev/null; then
--
2.29.2