I was earlier using System.out.println
to see my java console application's output in Netbeans.
The program took about 10 minutes to run and show the outputs while it was running.
Now I've substituted all System.out.println's
with slf4j's
logger
private final Logger logger = LoggerFactory.getLogger(MyClass.class);
logger.info("number of rows of x: " + numberOfx);
Now the program takes 28 minutes to run and show outputs (no other changes done).
I haven't done any extra configuration in the pom
file or anywhere else. I just added the local jars of slf4j-api:1.7.1
and slf4j-simple:1.7.18
into the Netbeans project and added the imports
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Since I've done only this much, and because the outputs are showing up on the Netbeans console in red colour, I assume the outputs aren't being written to disk.
If so, two questions:
1. Is log4j
or slf4j
output known to be slower than System.out.println
?
2. Is there any way to speed up the outputs? (perhaps it's slow because of some internal checks which could be disabled?)
3. I need my program to run fast. Is there a way to globally switch off the logging, instead of going to every file and commenting out the logger.info()
statements?