Yesterday I worked on logging, specifically RollingFileAppender. What this does is to roll over log files. So for example if I have a log file "error.log", when it reaches a certain size I want to roll that file over to a backup file and clear "error.log". In the general case there may be a sequence of backup files. I based my original implementation of RollingFileAppender in Log4j 1.2 which rolls "error.log" to "error.log.1" and then to "error.log.2" etc. if there are more. But I wanted more flexibility in the file names because I use these log files for websites and my webserver determines the content-type from the extension, so an extension of ".1" isn't helpful. I would rather have "error.log" roll over to something like "error_1.log".

So I looked at later implementations of RollingFileAppender. Here is the Log4j 2.x implementation. Here we see the decay of modern culture with increasing pointless complexity. Digging through this crap, I see that they use a filePattern to describe the files, this pattern being undocumented. Next I looked at Logback which is the latest logger by the same author. This is even more of a mess, but at least it is documented.

After viewing these horrors, an angelic voice in my head screamed "Fuck this complexity" and the solution became apparent to me. Here it is. I just pass in an array of fileNames. No need to generate anything. And here is how using it changed.

Just a typical day in the life of a reactionary programmer rejecting the horrors of modern programming and going in the opposite direction toward simplicity.

[–][deleted] 2 insightful - 2 fun2 insightful - 1 fun3 insightful - 1 fun3 insightful - 2 fun - (4 children)

[–]fschmidt[S] 2 insightful - 2 fun2 insightful - 1 fun3 insightful - 1 fun3 insightful - 2 fun - (3 children)

[–]

[deleted](2 children)[deleted]

[–]fschmidt[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (1 child)

[–]trident765 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (0 children)

[–][deleted] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (0 children)

[–]trident765 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (1 child)

[–]fschmidt[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (0 children)

[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (7 children)

[–]

[deleted](1 child)[deleted]

[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (0 children)

[–]fschmidt[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (4 children)

[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (3 children)

[–]fschmidt[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (2 children)

[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (1 child)

[–]fschmidt[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (0 children)