• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Questions about the logging facility

Figlmüller

Member
Hi,

I have some questions regarding the logging facility of the darkcoin daemon:

Does the daemon implement some kind of log rotation mechanism? Log files are getting huge after a few days of run time.
If not, can I safely rotate the file using the log rotation feature of the operating system? Or will the daemon end up in smoke if the log file is being (re)moved? Some applications tend to do this due to lost file handles /etc.

Is it possible to determine the log file path via a configuration paramter?

Can I customize the type of output made by the logger? The current logger does not seem to distinguish between different traditional logging levels such as TRACE, DEBUG, INFO, WARN, ERROR, etc. I really would like to filter unwanted information.

Does anyone know something about that?

Regards,
Figlmüller
 
If it helps, I have been deleting log files every few weeks with no ill effects.

I really want to get a better understanding of the log files too.
 
Okay, weird things happen while rotating on my machine. I configured logrotate on Debian Jessie to recreate the debug.log file with the same file permissions.
The thing is: The file is being moved and compressed.
The problem is: The daemon doesn't write to the newly created debug.log, but to the compressed debug.log.gz resulting in file corruption as darkcoind seems to attach uncompressed output to the file. This is some really weird thing.
Deleting both, the compressed file and the empty debug.log did not help. I'm now stuck with no debug.log at all. And yes, I have waited some time in order to allow buffers to be written to the disk.
I really hope that the daemon does not stop working once the log buffers are full. Or better no, I hope it stops running. I haven't seen the code yet, but if the whole buffer thing isn't written well, it may result in overflows or memory leaks.

Here you can see the output of lsof --> The debug.log file changed to the compressed one.
Code:
darkcoind   222         dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 223     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-s   222 224     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 273     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-d   222 276     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-n   222 279     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-a   222 280     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-o   222 281     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-m   222 282     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-d   222 283     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 284     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 285     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 286     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 287     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-w   222 288     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
 
Last edited by a moderator:
Okay, weird things happen while rotating on my machine. I configured logrotate on Debian Jessie to recreate the debug.log file with the same file permissions.
The thing is: The file is being moved and compressed.
The problem is: The daemon doesn't write to the newly created debug.log, but to the compressed debug.log.gz resulting in file corruption as darkcoind seems to attach uncompressed output to the file. This is some really weird thing.
Deleting both, the compressed file and the empty debug.log did not help. I'm now stuck with no debug.log at all. And yes, I have waited some time in order to allow buffers to be written to the disk.
I really hope that the daemon does not stop working once the log buffers are full. Or better no, I hope it stops running. I haven't seen the code yet, but if the whole buffer thing isn't written well, it may result in overflows or memory leaks.

Here you can see the output of lsof --> The debug.log file changed to the compressed one.
Code:
darkcoind   222         dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 223     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-s   222 224     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 273     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-d   222 276     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-n   222 279     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-a   222 280     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-o   222 281     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-m   222 282     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-d   222 283     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 284     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 285     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 286     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
darkcoind   222 287     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
bitcoin-w   222 288     dcnode    4w      REG             145,44 31658073   33822903  (deleted)/home/dcnode/.darkcoin/debug.log.1
Did you try the copytruncate option for logrotate? It should solve your problem.

copytruncate
Truncate the original log file in place after creating a copy,
instead of moving the old log file and optionally creating a new
one, It can be used when some program can not be told to close
its logfile and thus might continue writing (appending) to the
previous log file forever. Note that there is a very small time
slice between copying the file and truncating it, so some log-
ging data might be lost. When this option is used, the create
option will have no effect, as the old log file stays in place.
--> http://linuxcommand.org/man_pages/logrotate8.html
 
Back
Top