dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.2k forks source link

Debug.log is not recreated if moved/zipped #643

Closed extincted closed 8 years ago

extincted commented 8 years ago

Hi, I have the -debug=net enabled (which I need to retrieve information about a little project of mine). Problem is that the file get big very fast (of course). My problem was when i tried to rotate the file (manual cronjob just gziping the file), there's no new debug.log.

It's not a critical bug but it would be nice to be able to rotate the files (or maybe via the daemon?).

So how to recreate: Enable debuging (-debug will do). Remove .dash/debug.log

No new file is created.

deusstultus commented 8 years ago

Log rotation of this nature would better be handled by truncating the log file than deleting it, e.g. echo > debug.log

crowning- commented 8 years ago

I just checked and @deusstultus solution is probably the most practical one. Several threads write into debug.log, so implementing thread-safe log-rotation from within dashd itself would be quite some work.

UdjinM6 commented 8 years ago

Agree with @crowning-, @deusstultus 's solution seems to be the best way to deal with the issue - in general, it's always better to use simple tools that already do the work you need to be done rather than trying to implement everything in your own code imo.

Closing this.