3

Dude, stop using dependency injection for your loggers. We don't need to inject that crap. Just define it and be done.

Comments
  • 3
    A good part of our rants would be prevented by talking to each other, I think :/
  • 0
  • 0
    Huh? Why wouldn't you inject them. That's the way to go, no?
  • 0
    @Kimmax Don't believe it is, personally. `@Log4j` or whatever on the class to provide the logger is just simpler, easier, has less boilerplate and works fine. If you needed to mock it or switch out loggers at runtime then I'd agree - but that's rarely the case, and if you're testing log output that's... kinda weird, and points to other issues.
  • 0
    What if I don't want my tests project to have a dependency on whatever log framework we use?

    And it should be pretty easy to mock a logger. The mock framework I use does it for free
  • 0
    @M3m35terJ05h The tests project would have to have a dependency on the logger if it's just annotated rather than passed in via DI surely?
  • 0
    @AlmondSauce Yeah that's what I'm saying. I don't want that therefore I don't want annotations therefore I want di
  • 1
    @M3m35terJ05h Sorry, wrong way around, still waking up.

    If it's just annotated on the non-test class, why would that create a test dependency?
  • 1
    @AlmondSauce hmmm yeah actually I guess it wouldn't since the tests just depend on the already compiled main project so the tests don't need to know what to do with the annotation. Carry on.
Add Comment