|
Title: [PULL] Improve debug logging Post by: jgarzik on March 03, 2011, 01:58:58 AM URL: https://github.com/bitcoin/bitcoin/pull/90 This change does two things:
I've seen the request for log timestamping come from several people. Log rotation is something I wanted for server operation. Title: Re: [PULL] Improve debug logging Post by: jgarzik on March 03, 2011, 04:24:04 AM Separated out log timestamping at https://github.com/bitcoin/bitcoin/pull/91 Title: Re: [PULL] Improve debug logging Post by: Gavin Andresen on March 03, 2011, 03:45:13 PM You can't open and close the file; it is not thread-safe (thread one closes fp and sets it to NULL and sleeps, thread two wakes up and uses a NULL fp).
And you can't wrap the open/close in a CRITICAL_SECTION, because logging happens at shutdown, CRITICAL_SECTION relies on a destructor to work properly, and you can't control the order in which C++ destructors are called during shutdown. I learned all that the hard way a few releases back. You can rotate the logs using the "copytruncate" feature of logrotate (http://linuxcommand.org/man_pages/logrotate8.html). Title: Re: [PULL] Improve debug logging Post by: jgarzik on March 03, 2011, 04:47:10 PM You can rotate the logs using the "copytruncate" feature of logrotate (http://linuxcommand.org/man_pages/logrotate8.html). The logfile keeps expanding, under copytruncate, here. |