Skip to content

Commit

Permalink
Change stdout to stderr (#98)
Browse files Browse the repository at this point in the history
Standard output messages stopped appearing in systemctl status and
journalctl. They do appear only after the service is terminated.

Changing the stream to standard error is more suited in the given cases
and makes the messages appear in service log immediately.

Signed-off-by: Lukasz Florczak <[email protected]>
  • Loading branch information
lflorcza authored May 17, 2022
1 parent fe06a5b commit 44eba13
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/config_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ int ledmon_read_config(const char *filename)

if (!filename || (filename && access(filename, F_OK) < 0)) {
if (filename)
fprintf(stdout, "%s: does not exist, using global config file\n",
fprintf(stderr, "%s: does not exist, using global config file\n",
filename);
filename = LEDMON_DEF_CONF_FILE;
}

f = fopen(filename, "re");
if (!f) {
fprintf(stdout, "%s: does not exist, using built-in defaults\n",
fprintf(stderr, "%s: does not exist, using built-in defaults\n",
filename);
} else {
while (!feof(f)) {
Expand All @@ -228,7 +228,7 @@ int ledmon_read_config(const char *filename)

if (!list_is_empty(&conf.cntrls_whitelist) &&
!list_is_empty(&conf.cntrls_blacklist))
fprintf(stdout, "Both whitelist and blacklist are specified - ignoring blacklist.");
fprintf(stderr, "Both whitelist and blacklist are specified - ignoring blacklist.");

return STATUS_SUCCESS;
}
Expand Down

0 comments on commit 44eba13

Please sign in to comment.