Maybe this can help you? http://technogems.blogspot.com/2012/01/capture-colored-console-output-in.html