This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit 9c2cbe5ad53905d0792ead3ed5affc84b20e5a22
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 11 15:27:34 2024 -0600
wdmd: improve log levels and messages
---
wdmd/main.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/wdmd/main.c b/wdmd/main.c
index bbb4356..38a99f3 100644
--- a/wdmd/main.c
+++ b/wdmd/main.c
@@ -75,6 +75,7 @@ static int test_loop_enable;
static int dev_fd = -1;
static int shm_fd;
static int itco; /* watchdog_identity is "iTCO_wdt" */
+static int daemon_setup_done;
static int allow_scripts;
static int kill_script_sec;
@@ -131,6 +132,12 @@ do { \
syslog(LOG_ERR, fmt, ##args); \
} while (0)
+#define log_info(fmt, args...) \
+do { \
+ log_debug(fmt, ##args); \
+ syslog(LOG_INFO, fmt, ##args); \
+} while (0)
+
#define log_script(i) \
log_error("script %.64s last_result %d start %llu run %u fail %u good %u kill %u
long %u", \
scripts[i].name, scripts[i].last_result, \
@@ -404,8 +411,8 @@ static void close_watchdog(void)
rv = write(dev_fd, "V", 1);
if (rv < 0)
log_error("%s disarm write error %d", watchdog_path, errno);
- else
- log_error("%s disarmed", watchdog_path);
+ else if (daemon_setup_done)
+ log_info("%s disarmed", watchdog_path);
close(dev_fd);
dev_fd = -1;
@@ -2020,8 +2027,7 @@ static int lockfile(void)
rv = fcntl(fd, F_SETLK, &lock);
if (rv < 0) {
- log_error("lockfile setlk error %s: %s",
- lockfile_path, strerror(errno));
+ log_error("daemon already running (lockfile %s %d)", lockfile_path, errno);
goto fail;
}
@@ -2058,19 +2064,19 @@ static void setup_priority(void)
rv = mlockall(MCL_CURRENT | MCL_FUTURE);
if (rv < 0) {
- log_error("mlockall failed");
+ log_info("mlockall failed");
}
rv = sched_get_priority_max(SCHED_RR);
if (rv < 0) {
- log_error("could not get max scheduler priority err %d", errno);
+ log_info("could not get max scheduler priority err %d", errno);
return;
}
sched_param.sched_priority = rv;
rv = sched_setscheduler(0, SCHED_RR|SCHED_RESET_ON_FORK, &sched_param);
if (rv < 0) {
- log_error("could not set RR|RESET_ON_FORK priority %d err %d",
+ log_info("could not set RR|RESET_ON_FORK priority %d err %d",
sched_param.sched_priority, errno);
}
}
@@ -2081,7 +2087,7 @@ static int group_to_gid(char *arg)
gr = getgrnam(arg);
if (gr == NULL) {
- log_error("group '%s' not found, using socket gid: %i", arg,
DEFAULT_SOCKET_GID);
+ log_info("group '%s' not found, using socket gid: %i", arg,
DEFAULT_SOCKET_GID);
return DEFAULT_SOCKET_GID;
}
@@ -2296,8 +2302,10 @@ int main(int argc, char *argv[])
/* Sets watchdog_identity and itco */
setup_identity(watchdog_path);
- log_error("wdmd started S%d H%d G%d using %s \"%s\"", allow_scripts,
high_priority,
- socket_gid, watchdog_path, watchdog_identity[0] ? watchdog_identity :
"unknown");
+ log_info("wdmd started S%d H%d G%d using %s \"%s\"", allow_scripts,
high_priority,
+ socket_gid, watchdog_path, watchdog_identity[0] ? watchdog_identity :
"unknown");
+
+ daemon_setup_done = 1;
rv = test_loop();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.