Skip to content

Commit

Permalink
execute: increase severity of journal connect failure message
Browse files Browse the repository at this point in the history
journald is supposed to work. Failure to connect to its socket implies
losing messages. It should be a very unusual event. Log the failure with
LOG_CRIT.

Just because this unit's stdout/stderr failed to connect to the journal
does not necessarily mean that we shouldn't try to log the failure using
a structured entry, so let's use log_struct_unit.
  • Loading branch information
michich committed Feb 16, 2013
1 parent eb17e93 commit 80cbda3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,12 @@ static int setup_output(const ExecContext *context, int fileno, int socket_fd, c
case EXEC_OUTPUT_JOURNAL_AND_CONSOLE:
r = connect_logger_as(context, o, ident, unit_id, fileno);
if (r < 0) {
log_error("Failed to connect std%s of %s to the journal socket: %s",
log_struct_unit(LOG_CRIT, unit_id,
"MESSAGE=Failed to connect std%s of %s to the journal socket: %s",
fileno == STDOUT_FILENO ? "out" : "err",
unit_id, strerror(-r));
unit_id, strerror(-r),
"ERRNO=%d", -r,
NULL);
r = open_null_as(O_WRONLY, fileno);
}
return r;
Expand Down

0 comments on commit 80cbda3

Please sign in to comment.