9

I am using scala-logging. There are two classes LazyLogging and StrictLogging. I see, that the difference between them is that LazyLogging is initialized lazily. What is the purpose of that. When I should use one over the other and why?

rarry
  • 3,553
  • 20
  • 23

1 Answers1

4

Best always use StrictLogging. LazyLogging for when you want to postpone Logger initialization.

analytically
  • 223
  • 4
  • 4
  • 4
    What is a use case that would desire postponed Logger initialization? Generally, it seems like this could be nice if nothing was ever logged, but creating a logger seems pretty cheap, and creating a lazy val might result in deadlock (as I'm fussing with now). Are there better reasons to postpone logger initialization? – jon_wu Jun 28 '17 at 06:22