Taming Java logging dependencies

preview_player
Показать описание
Ever got confused about how to deal with logging dependencies in Java? There is slf4j, logback, log4j, java-util-logging, and different rules for applications vs libraries. This video goes through in painful detail the best practices on how to configure dependencies for all different scenarios.


The rules
---------

* The only **compile** time dependency should be `slf4j-api`
* For libraries: only add test-scoped dependencies on something like `slf4-simple`
* For apps: add a runtime dependency on the logging framework with config.
* For libraries: no config should be included in the dependency!!
* Exclude logging frameworks from misconfigured dependencies

00:00 Introduction
00:20 Setting up a demo app with console logs
00:58 Setting up log4j
02:54 Introducing a dependency
06:35 Setting up logback
08:29 Introducing SLF4J
11:00 Fixing multiple implementations problem
12:40 sl4fj-simple in tests
14:15 Logging to files
15:42 Seperate test logging config
17:15 The rules
20:16 Excluding bad dependencies
21:15 Summary
Рекомендации по теме