[Improvement] Don't rename the log file before rotation

Discuss newly added features or request new features.
Post Reply
chickenwings
Posts: 5
Joined: 22 Apr 2015, 18:34

[Improvement] Don't rename the log file before rotation

Post by chickenwings » 07 Jan 2016, 11:37

Hi,
Could you make the current log file name nzbget.log regardless of the date even when rotation is active? It would make it easier to follow than the current format which looks like nzbget-2016-01-07.log and is thus harder to type.
Of course, to follow the usual logrotate pattern, the log would be renamed every day when it rotates.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Improvement] Don't rename the log file before rotation

Post by hugbug » 07 Jan 2016, 12:06

Don't rename the log file before rotation
There are no renaming currently. The files are created with correct dates and never renamed.

What you suggest is "renaming" and this makes things unnecessary complex.

Currently:
- when a new log-entry must be written the file name is generated based on current date and the text is written there;
- periodically and on program start the existing files on disk are checked (their file names) and removed if necessary.

With your suggestion:
- before writing into the file the program must know if it should rename the existing "nzbget.log" first. For that it needs to know from what dates the entries are in the file. When the program is started it would need to read the log-file and parse it to determine that date;
- when the program is running it could store the date of the last written entry; that would eliminate the need of reading the file but this is not always safe: the system date could be changed by user or another program instance could have written into file, for example when a command was sent via terminal (like "nzbget -P").

Considering the fact that the log-file is intended for rare troubleshootings as opposed to everyday use this improvement isn't worth the trouble. If you still need to read the file often write a small script which will "cat" from the most recent file (or sort file names).

Don't forget about web-interface -> tab "History" -> open item details -> button "Log".

chickenwings
Posts: 5
Joined: 22 Apr 2015, 18:34

Re: [Improvement] Don't rename the log file before rotation

Post by chickenwings » 08 Jan 2016, 08:26

Well I simply prefer following logs than using the Web UI :)
I decided to use the append mode and create a logrotate file, that seems to suit my needs as well.
You can mark this topic as closed, thanks for the quick reply!

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests