You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Desjardins, Daren" <da...@vontu.com> on 2007/03/28 03:50:41 UTC

log4j and console progress bars

I have been trying to find how to configure log4j such that a console
app can print out a progress bar as a long running task progresses.
Ideally it would be something of the form "Progress: 12%" and percentage
would increment on the same line, not printing a new line for every
increment.

 

Unfortunately I have not been able to find out how to make it so I can
write directly to the console (system.in or system.err is fine) without
performing a newline to get it to flush.

 

Has anyone else tried to perform something similar?

 

My current example is of the form:

 

For(..)

{

            Percentage++;

            System.err.print("Progress:" + percentage + "\b\b");

            System.err.flush();

}