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

Only write the trace file in the event of an error #73

Closed
bobbingwide opened this issue Sep 17, 2018 · 4 comments
Closed

Only write the trace file in the event of an error #73

bobbingwide opened this issue Sep 17, 2018 · 4 comments

Comments

@bobbingwide
Copy link
Owner

@bobbingwide bobbingwide commented Sep 17, 2018

Requirement

  • Only write the trace file in the event of an error.

Considerations

  • Should we defer opening the trace file until an error has been detected?
  • Or, at the end of the transaction, delete the file if there weren't any trace records at or above the tracing level actually written? Ignoring records written using BW_TRACE_ALWAYS.

Proposed solution

  • Investigate the two considerations above.
  • Update the trace summary report to help identify transactions with "errors".
@bobbingwide

This comment has been minimized.

Copy link
Owner Author

@bobbingwide bobbingwide commented Nov 23, 2019

I decided it was high time to attempt to implement this. I didn't bother to investigate the first option - deferring writing the file. I went for the simple one. Purge the trace file if no errors were traced.

Implementation details

  • Added a new counter $trace_error_count to the BW_trace_record class
  • This is incremented each time a trace record is traced with a trace level that indicates that some form of Error has been detected and traced.
level Is this considered an error?
BW_TRACE_ALWAYS No. This is the default
BW_TRACE_DEBUG No.
BW_TRACE_VERBOSE No.
BW_TRACE_NOTICE Yes. For the time being
BW_TRACE_ERROR Yes.
BW_TRACE_INFO No.
BW_TRACE_WARNING Yes. For the time being
  • The number of errors are shown in the trace record between the trace count and the timestamp.
  • The figure is reported in the daily trace summary report record after the trace file name and trace record count.
  • When tracing is not active the values are empty.
  • A new checkbox in settings > oik action options labelled "Purge trace file if no errors" is used to control the behaviour.
  • When checked then logic kicks in at shutdown
  • The shutdown function checks the value of the trace error count.
  • If this is 0 the trace file is purged.
@bobbingwide

This comment has been minimized.

Copy link
Owner Author

@bobbingwide bobbingwide commented Dec 4, 2019

After a certain amount of live usage, while writing the documentation, I think I'll change it so that BW_TRACE_NOTICE and BW_TRACE_INFO level trace records are not considered to be trace errors.

@bobbingwide

This comment has been minimized.

Copy link
Owner Author

@bobbingwide bobbingwide commented Dec 5, 2019

This can now be closed.

@bobbingwide bobbingwide closed this Dec 5, 2019
v3.0.0 - Improved control over tracing and GDPR considerations automation moved this from In progress to Done Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.