Skip to content

Commit

Permalink
engine: add logging for errors during engine initialization. (fluent#…
Browse files Browse the repository at this point in the history
…3723)

Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan authored Aug 5, 2022
1 parent 111f6e7 commit dbbc7a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/flb_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ int flb_engine_failed(struct flb_config *config)

/* Check the channel is valid (enabled by library mode) */
if (config->ch_notif[1] <= 0) {
flb_error("[engine] no channel to notify FAILED message");
return -1;
}

Expand Down Expand Up @@ -565,6 +566,7 @@ int flb_engine_start(struct flb_config *config)
/* Create the event loop and set it in the global configuration */
evl = mk_event_loop_create(256);
if (!evl) {
fprintf(stderr, "[log] could not create event loop\n");
return -1;
}
config->evl = evl;
Expand Down Expand Up @@ -604,6 +606,7 @@ int flb_engine_start(struct flb_config *config)
/* Start the Logging service */
ret = flb_engine_log_start(config);
if (ret == -1) {
fprintf(stderr, "[engine] log start failed\n");
return -1;
}

Expand Down Expand Up @@ -639,6 +642,7 @@ int flb_engine_start(struct flb_config *config)
/* Start the Storage engine */
ret = flb_storage_create(config);
if (ret == -1) {
flb_error("[engine] storage creation failed");
return -1;
}

Expand All @@ -661,12 +665,14 @@ int flb_engine_start(struct flb_config *config)
/* Initialize input plugins */
ret = flb_input_init_all(config);
if (ret == -1) {
flb_error("[engine] input initialization failed");
return -1;
}

/* Initialize filter plugins */
ret = flb_filter_init_all(config);
if (ret == -1) {
flb_error("[engine] filter initialization failed");
return -1;
}

Expand All @@ -676,6 +682,7 @@ int flb_engine_start(struct flb_config *config)
/* Initialize output plugins */
ret = flb_output_init_all(config);
if (ret == -1) {
flb_error("[engine] output initialization failed");
return -1;
}

Expand Down
1 change: 1 addition & 0 deletions src/flb_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ void flb_log_print(int type, const char *file, int line, const char *fmt, ...)
if (w) {
int n = flb_pipe_write_all(w->log[1], &msg, sizeof(msg));
if (n == -1) {
fprintf(stderr, "%s", (char *) msg.msg);
perror("write");
}
}
Expand Down

0 comments on commit dbbc7a7

Please sign in to comment.