You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to find a way to delete(or truncate to 0) the log file produced by the logging backend.
Here's the usage scenario:
Disable logging
Delete old log file and create new log file (or truncate the existing file)
Enable logging
What I found at the moment through exploration and trial and error:
I'm able to disable/reenable the logging backend using log_backend_disable() and log_backend_enable()
Using fs_unlink(), I'm able to delete the file but after further testing, I discovered that since the logging system retains its copy of the fs_file_t structure, it continues to write to the old file even though it doesn't exist anymore.
And due to the same fs_file_t structure, I'm not able to open/truncate the file in a different thread since fs_open() returns -EBUSY because it's already in use by the logging thread.
I'm not sure if there's an existing API that does what I'm looking for.
Do you have any suggestions or advice on how to approach this issue?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I'm trying to find a way to delete(or truncate to 0) the log file produced by the logging backend.
Here's the usage scenario:
What I found at the moment through exploration and trial and error:
I'm able to disable/reenable the logging backend using log_backend_disable() and log_backend_enable()
Using fs_unlink(), I'm able to delete the file but after further testing, I discovered that since the logging system retains its copy of the fs_file_t structure, it continues to write to the old file even though it doesn't exist anymore.
And due to the same fs_file_t structure, I'm not able to open/truncate the file in a different thread since fs_open() returns -EBUSY because it's already in use by the logging thread.
I'm not sure if there's an existing API that does what I'm looking for.
Do you have any suggestions or advice on how to approach this issue?
Beta Was this translation helpful? Give feedback.
All reactions