Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(windows): Make sure to log the final error message #15346

Merged
merged 1 commit into from
May 15, 2024

Conversation

srebhan
Copy link
Contributor

@srebhan srebhan commented May 13, 2024

Summary

When exiting a program with log.Fatal, the program does not execute any deferred calls and will also exit immediately. For logging with the Windows event-logger interface, this means that the connection to the logger is not shut down gracefully and thus the final (and most important) log message is lost.

This PR does not use log.Fatal to log the message but rather rely on log.Print which allows for a graceful exit. Furthermore, we move the logging into the runApp function which really is the core processing loop.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #14144

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label May 13, 2024
@srebhan srebhan added platform/windows area/windows Related to windows plugins (win_eventlog, win_perf_counters, win_services) labels May 13, 2024
@srebhan srebhan assigned srebhan, powersj and DStrand1 and unassigned srebhan May 13, 2024
@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label May 13, 2024
Copy link
Contributor

@DStrand1 DStrand1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

@DStrand1 DStrand1 removed their assignment May 14, 2024
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for tracking this down.

@powersj powersj merged commit ae326bc into influxdata:master May 15, 2024
27 checks passed
@github-actions github-actions bot added this to the v1.30.3 milestone May 15, 2024
powersj pushed a commit that referenced this pull request May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/windows Related to windows plugins (win_eventlog, win_perf_counters, win_services) fix pr to fix corresponding bug platform/windows ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

windows: As a service, telegraf logs do not capture error message on failure
3 participants