1

It seems all Java logging solutions recommend creating a logger as a static field of class that needs to log.

Why these solutions choose logger instances and not just a single class with a handful of static methods?

What are the main benefits?

Igor Gatis
  • 4,648
  • 10
  • 43
  • 66
  • I can think of some synchronization/performance issues. All threads sharing the same global static logger would potentially have to deal or wait on other thread bad behavior. Static objects are not conducive to a dynamic feed injection modern day app? Why else, OSGI modularity is that enough to answer? – Duncan Krebs Apr 23 '20 at 02:09
  • 1
    Although my question has been closed due too a very similar question made on C#, I'd argue Java and C# have enough (compile time) differences which legitimate my question on its own. – Igor Gatis Apr 23 '20 at 03:27

0 Answers0