You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2014/02/09 20:46:11 UTC

Default Rollover Strategy is too complex and misnamed

Looking at the docs and code for the Default Rollover Strategy, it seems to
me we are overloading the config and the code in a non-OO fashion to ram
two different strategies in the same strategy: 'fixed window' (need a
better name) vs. that other unnamed one.

The confusion is even enshrined in the docs: "The default rollover strategy
supports two variations for incrementing the counter." To me, a default
should have one behavior, not two, especially when the file shuffling is
quite different. It does not help that the docs do not describe the goal of
first the strategy and goes right into talking about some parameter is 1
and the other is 3. :(

My desire to add a third strategy made it clear (to me) that I should NOT
further complicate this "default" strategy.

My proposal is to first split the current class into two, which will then
make it easier I hope for me to implement the following: a strategy that
does NOT rename but instead always starts with the 'full' file name. For
example I want: The first file is 2014-02-09.log, and at midnight, the
rollover creates a new file 2014-02-10.log and logging continues there, and
so on. No renaming. The date/time/index of the file is when the log window
starts (as opposed to when it ends, which I find confusing). Old logs can
be deleted as we currently do.

We can then discuss which of the three should be the "default" if ANY. I
would argue that there should not be a "default" strategy, just pick one of
the three, and give them good names.

That would make it all much simpler to explain and document than the
current situation.

Thoughts?

Gary

PS: If we had to pick a "default" a la config by exception, then I would
pick the least resource intensive one (the no rename one ;).

G



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory