I looked up the api about the logger class(here) and I was looking at the Logger.info
method. I was confused when I saw its perimeter as a message displayed as a string public void info(String msg)
which is same as System.out.println()
. I am wondering what is the different between these two, and why do we use Logger instead of System.out.println
when they can print out the same thing.
In Logger.
Logger.info("Hello")
Output:
[INFO ] 2015-08-07 11:18:46.140 [main] ClassName Hello
In System.out.println
`System.out.println("Hello")
Output:
Hello
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…