Reducing the size of Checkstyle logs

If you use Checkstyle, especially as part of an automated build you may notice that the size of the log file can be a bit big.
I did, anyway, so I wrote a stylesheet to trim it down to size.


Checkstyle puts lots of entries into its log file; a minimum of 1 per file, possibly more. This can make the log file quite large; a typical log file for my current project is about 1/2 MB. This chews up disk space when you have several hundred archived logs, and it slows down processing of the log file.

The above stylesheet is easily integrated into your ant scripts, using the Ant style task, and generally makes life a lot nicer.

Advertisements

Author: Robert Watkins

My name is Robert Watkins. I am a software developer and have been for over 18 years now. I currently work for people, but my opinions here are in no way endorsed by them (which is cool; their opinions aren’t endorsed by me either). My main professional interests are in Java development, using Agile methods, with a historical focus on building web based applications. I’m also a Mac-fan and love my iPhone, which I’m currently learning how to code for. I live and work in Brisbane, Australia, but I grew up in the Northern Territory, and still find Brisbane too cold (after 16 years here). I’m married, with two children and one cat. My politics are socialist in tendency, my religious affiliation is atheist (aka “none of the above”), my attitude is condescending and my moral standing is lying down.

4 thoughts on “Reducing the size of Checkstyle logs”

  1. hmm… so why you do you use checkstyle if you’re not reducing the errors it find? 🙂 Also, if the errors are not getting fixed quickly maybe it’s because they’re not important and should be removed from the checkstyle config file?

    Personally, I prefer to reduce the number of checkstyle checks done and make the one that we decide to keep fail the build. That way there’s no need for HTML page generation and no log size issue! 🙂

  2. Vincent, I think you misunderstood the purpose of the filter. The filter removes the files that _pass_ the checkstyle checks, leaving just the errors.

    The main use I have for this is as part of my Cruisecontrol builds; I’m only interested in the errors in this scenario, so taking out the noise speeds up the log file processing a lot.

  3. Thanks Robert. Very handy indeed, especially if you work on a project with a lot of weird, but enforced (ie. will break the build), style rules.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s