Friday, May 25, 2018

I had not heard the term "rolling log" before but now Tabpy has one


From the "you learn something new every day" category, I saw that we had a proposed enhancement to Tabpy to support a rolling log.  I had not heard that term before but the concept is fairly simple.

Suppose your application creates a log whenever it gets started.  That log is named "My Application Log.txt" and is saved when the application exits.  Now you have a dilemma.  Suppose I start the application, run it for a bit then exit.  I have my log file.  Then I start it again.

What do I do with the previous log file?

Some obvious options:

  1. I could have the application delete it and start a new one.
  2. I could just keep adding to the existing log
  3. I could create a new log with a different name

Each one of these has pros and cons.  Idea 1 is simple - easy to understand, but you lose the history of what had happened last time the application ran.  That information is often useful if you need to troubleshoot

2 and 3 both keep all that history, but the hard drive will eventually get full.

Option 4 is the Rolling Log.  It is like 3, but deletes all except the last few logs.  I can set it to keep the 5 most recent, 2 most recent, 10 most recent, etc…  Then I retain some amount of history but avoid filling up the hard drive over time.

Check out the proposed change we want to take for Tabpy over at https://github.com/tableau/TabPy/.  The pull request is the current request as I write this but that will change over time.


Questions, comments, concerns and criticisms always welcome,
John

2 comments: