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

前端 未结 4 1909
南旧
南旧 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条回答
  •  轮回少年
    2020-12-30 02:36

    The main difference between a Logger and System.out.println is
    Logger: Prints the text in a file(text file)
    System.out.println: Prints the output in console

    Logger is useful when you are going for any LIVE projects.
    Because if any project is developed and deployed, then you cannot check the console. At that time Logger will be useful to track the flow of your project also you can find the Error or Exception if you have given the logger in catch{...} block.

    Also go through this Logger vs. System.out.println

提交回复
热议问题