Taming Java logging dependencies
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.
Source code for this video is at https://github.com/coderbin-dev/taming-java-logging
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!!
* If any dependencies use `java.util.logging` then use `jul-to-slf4j`
* 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
17:57 Dealing with java.util.logging
20:16 Excluding bad dependencies
21:15 Summary
Видео Taming Java logging dependencies канала coderbin
Source code for this video is at https://github.com/coderbin-dev/taming-java-logging
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!!
* If any dependencies use `java.util.logging` then use `jul-to-slf4j`
* 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
17:57 Dealing with java.util.logging
20:16 Excluding bad dependencies
21:15 Summary
Видео Taming Java logging dependencies канала coderbin
Комментарии отсутствуют
Информация о видео
16 февраля 2025 г. 20:19:38
00:21:44
Другие видео канала