0

I am trying to integrate logging into a current Spring Boot app, but I have some questions regarding the following points. Could you clarify this for me?

1. Which logging library should I use? Logback or Slf4j? I want to use the most common or proper one.

2. Where should I add logging? For example, my app only retrieves data from CSV files, and I am unsure if I should add a log as info after reading data or if no record was found in CSV (I will add my global exception handler).

devblack.exe
  • 428
  • 4
  • 17
Jack
  • 1
  • 21
  • 118
  • 236
  • "*Which logging library should I use? Logback or Slf4j?*" It's the wrong question. It's not one or the other. Logback is an implementation. Sl4fj is a facade. `spring-boot-starter-logging` includes both. "*Where should I add logging?*" Matter of opinion. – Michael Nov 25 '22 at 12:41
  • @Michael Thanks for reply, but I have seen both of them in some projects. So, I think I will use one of them, but which one? Could you explain a little bit more? – Jack Nov 25 '22 at 12:44
  • @Michael Regarding to where I should use, I mean except from error, validation situations, where should I add. Juts give me some suggestion pls? – Jack Nov 25 '22 at 12:45
  • General logging like `info` is usually used at points where data problems can occur or when you need to confirm the execution of some method. But there are also different levels of logging, like debug and trace, and all of them are differently configurable and can have different usage depending on your personal point of view – Markiian Benovskyi Nov 25 '22 at 12:52
  • @MarkiianBenovskyi Thanks a lot. Then, would you suggest a suitable article for a Spring Boot app? I read this but it may be better for Microservices. ANy idea? https://reflectoring.io/springboot-logging/ – Jack Nov 25 '22 at 13:12
  • @Closures Why close??? – Jack Nov 25 '22 at 13:54

0 Answers0