What is the difference between Java Logger and System.out.println

前端 未结 4 1921
南旧
南旧 2020-12-30 02:30

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

4条回答
  •  猫巷女王i
    2020-12-30 02:42

    Usually, because a Logger can be configured to write to a file (and the console). It might also be configured at higher (or lower) granularity as to messaging. For example, you might configure (at runtime) for level of warn. In which case, that logger would not display debug or info messages. It can include information such as the class that is writing, a line number, and a date and time (of the message).

提交回复
热议问题