About what is this post?
Last time, We had a problem with too much log files on production server. Everyone know that better is not to remove them. Sometimes you need to check this files to fix the bug. So I ask myself a question what to do to do it faster? Write a program to do that. So i do that. Coding simple programs or just coding is good practice to learn useful library in java that can help you doing common things. With maven You can very fast code programs. For example on logcompressor i spend maybe about 5 hours. The code for logcompressor You find in https://bitbucket.org/lukasz_wozniak/logcompressor . If You check pom.xml I’m using many library that is very helpful in work.
What this program do?
This program is very simple it doesn’t have yet any configuration base on log4j files. I give You an example what is he doing. We have list of log files:
if we execute program with parameters from target folder :
java -jar LogCompressor-1.0-jar-with-dependencies.jar /folder/with/logfiles true
We compress files from this folder in file log-YYYY-MM.archive.zip. So after executing we get files:
Second parameter is just parameter that remove not compressed log files. So we just get in our /folder/with/logfiles only zip files.