[logback-user] logback console appender slow on windows xp

ceki ceki at qos.ch
Tue Dec 20 18:50:02 CET 2011


Hi Peter,

If I understand correctly, you have shown that invoking 
System.out.println is slow with javaw. Do you know why?
If the reason was known, for example it was due to exceptions being 
thrown, ConsoleAppender could address that problem.

Is it possible to check whether an app is running under javaw and not 
java? ConsoleAppender could disable itself under javaw.

-- 
Ceki
http://twitter.com/#!/ceki

On 20.12.2011 18:34, Peter Kullmann wrote:
> Hi,
>
> we had a problem with the performance of our application and it boiled down to very bad performance of the console appender when there is no console (in particular on windows xp).
>
> You can see the whole context of the issue here: http://www.eclipse.org/forums/index.php/m/768740/#msg_768740
>
> Here's the conclusion and the code for my experiments:
>
>
> package testlogback;
>
> import java.io.FileWriter;
> import java.io.IOException;
>
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> public class Main {
>      public static void main(String[] args) throws IOException {
>          Logger logger = LoggerFactory
>                  .getLogger("chapters.introduction.HelloWorld1");
>          long start = System.currentTimeMillis();
>          for (int i = 0; i<  10000; i++) {
>              logger.debug("Hello world.");
>          }
>          long end = System.currentTimeMillis();
>
>          FileWriter fileWriter = new FileWriter("logbacktest.out");
>          fileWriter.write("Time: " + (end - start) + "\n");
>          fileWriter.close();
>          System.out.println("Time: " + (end - start));
>      }
> }
>
>
> On my windows box it prints out "Time: 140" when started as "java -jar testlogback.jar". If I start "javaw -jar testlogback.jar" it uses 100% CPU for about 20 seconds (for effectively doing nothing). This is the case for Sun ire 6 and 7 on windows xp.
>
> On windows 7 the situation is better: javaw uses only about 7 seconds (which is still too much, I guess).
>
> Best regards,
> Peter
>


More information about the Logback-user mailing list