Netflix / blitz4j

Logging framework for fast asynchronous logging
Apache License 2.0
563 stars 117 forks source link

The supplied unit tests don't work #1

Closed antonvo closed 11 years ago

antonvo commented 11 years ago

Firstly, the unit tests are not properly included into the Gradle configuration. Once that it done using the following build.gradle block:

sourceSets {
    test {
        java {
            srcDirs  = ['test/main/java']
        }
    }
}

... the tests run and fail. Both of them.

From the output that they generate at least these things are obvious:

a) slf4j-simple dependency is missing (the infamous SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". error) b) PatternLayout settings are obviously ignored since the pattern of the printed messages is the log4j default c) Reconfiguration attempt of the testReconfiguration unit test gets ignored

The above is true for both the current v1.13 github code and v1.11 distribution from Maven. I've tried them both and I could not make any of them work.

karthik-vn commented 11 years ago

I have fixed the dependencies required for the tests in the latest source. The tests were also in the wrong directory and gradle wouldn't pick it up - so you don't have to make the changes above in build.gradle. Give it a try now.

antonvo commented 11 years ago

It does work now. Thank you.

The dependency "org.slf4j:slf4j-log4j12:1.6.1" seems to have made all the difference. I think it is worth mentioning in the wiki that in order for Blitz4j to work the application MUST use it.

Is there any reason for using different versions of slf4j-log4j12 and slf4j-api?

antonvo commented 11 years ago

And please have the Maven Central updated with the latest version.

karthik-vn commented 11 years ago

I have updated the slf4j-log4j version to be the same version as the api now. I have also released the artifact to maven. It should appear in maven central in a few hours.

Closing this issue...

karthik-vn commented 11 years ago

BTW, there is no direct dependency on slf4j libraries. Only the unit tests depend on it and hence I think we don't have to specify in the wiki. For instance, you can choose to use commons-logging,log4j or slf4j apis as long as the underlying implementation is log4j.

andrewachen commented 10 years ago

Hmph, I got bitten by the same problem -- simply including blitz4j as a Gradle dependency was insufficient; I had to add org.slf4j:slf4j-log4j12:1.6.4 to get it to work. Without it, I get the same error as @antonvo in (a).

This is an empty app with pretty much just logging. I really think this should be a compile dep, not just a test dep.