Not able to use slf4j-backend
- Dominant language
- Java
- Stars
- 1.5k
- Forks
- 133
- Avg merge
- 6m
- Merged PRs (30d)
- 7
Description
Using these dependencies:
```xml
com.google.flogger
flogger
0.4
com.google.flogger
flogger-slf4j-backend
0.4
ch.qos.logback
logback-classic
1.2.2
```
should be enough if I understand https://github.com/google/flogger#how-to-use-flogger correctly.
But this test:
```java
public class FloggerTest {
private static final FluentLogger log = FluentLogger.forEnclosingClass();
@Test
public void test() {
log.atWarning().log("Test: %s", "message");
}
}
```
fails with:
```
java.lang.ExceptionInInitializerError
at com.google.common.flogger.backend.Platform.getCallerFinder(Platform.java:142)
at com.google.common.flogger.FluentLogger.forEnclosingClass(FluentLogger.java:70)
at test.FloggerTest.(FloggerTest.java:10)
Caused by: java.lang.IllegalStateException: No logging platforms found:
com.google.common.flogger.backend.system.DefaultPlatform: java.lang.ClassNotFoundException: com.google.common.flogger.backend.system.DefaultPlatform
at com.google.common.flogger.backend.Platform$LazyHolder.loadFirstAvailablePlatform(Platform.java:99)
at com.google.common.flogger.backend.Platform$LazyHolder.(Platform.java:67)
... 25 more
```
According to https://github.com/google/flogger/blob/master/log4j/src/main/java/com/google/common/flogger/backend/log4j/Log4jBackendFactory.java#L30 you have to set the `flogger.backend_factory` system property, so I started Java with `-Dflogger.backend_factory=com.google.common.flogger.backend.slf4j.Slf4jBackendFactory#getInstance`, but this resulted in the same exception.
What am I missing?
(the whole project can be found at: https://github.com/PascalSchumacher/flogger-slf4j-test)
Contributor guide
Assessment
This issue has not been assessed yet.