Skip to content
New issue

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

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

Already on GitHub? # to your account

Logging exception handler and fix for stable_log_filename on windows #2880

Conversation

guilhermelawless
Copy link
Contributor

@guilhermelawless guilhermelawless commented Aug 13, 2020

Although our logger has never thrown in normal conditions, it has been reported to when stressing the RPC in a RAM node, especially with a low rotation file size. This adds an exception handler that handles by simply printing to stderr. I could not find a way to test the handler in a unit test.

Also fixes an issue with the stable_log_filename config on Windows. The node.log file was being created with read-only permissions, so writing to the file after restarting the node would throw an exception. This will be noted in the documentation. However, this also couldn't be unit tested because the file gets the full permissions by default.

The change to nano::logging::release_file_sink () enables the added test.

Although our logger has never thrown in normal conditions, it has been reported to when stressing the RPC in a RAM node, especially with a low rotation file size. This adds an exception handler that handles by simply prints to stderr.

Also fixes an issue with the `stable_log_filename` config on Windows. The `node.log` file was being created with read-only permissions, so writing to the file after restarting the node would throw an exception. However, this can't be unit tested because the file gets the full permissions by default.

The change to `nano::logging::release_file_sink ()` enables the added test.
clemahieu
clemahieu previously approved these changes Aug 13, 2020
@guilhermelawless guilhermelawless merged commit 0007250 into nanocurrency:develop Aug 24, 2020
@guilhermelawless guilhermelawless deleted the logging/stable-log-filename-crash branch August 24, 2020 17:54
guilhermelawless added a commit that referenced this pull request Sep 2, 2020
…2880)

* Logging exception handler and fix for stable_log_filename on windows

Although our logger has never thrown in normal conditions, it has been reported to when stressing the RPC in a RAM node, especially with a low rotation file size. This adds an exception handler that handles by simply prints to stderr.

Also fixes an issue with the `stable_log_filename` config on Windows. The `node.log` file was being created with read-only permissions, so writing to the file after restarting the node would throw an exception. However, this can't be unit tested because the file gets the full permissions by default.

The change to `nano::logging::release_file_sink ()` enables the added test.

* Set permissions for pre-existing log file as well, as Boost re-creates with read-only on rotation
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants