I'm developing a library using hibernate, and uses slf4j in the library. Therefore I want to make sure that the users, when having the right dependencies in their classpath, would use slf4j for logging. However I'm not able to get the jvm log to slf4j when the classpath looks right according to http://docs.jboss.org/hibernate/orm/4.3/topical/html/logging/Logging.html
My project's dependencies don't include jboss logmanager, log4j or log4j2. And it has slf4j and slf4j-simple in the classpath. However, the hibernate logs are not going to slf4j-simple unless I add -Dorg.jboss.logging.provider=slf4j in command line.
I'd like avoid making this system property a necessity for the library users.
1. Looking at my classpath, is this explainable? 2. Is there a way to find out what logging back end exactly hibernate is using?
My classpath:
classpath: /Users/lin/git/staas-authenticator/target/test-classes:/Users/lin/git/staas-authenticator/target/classes:/Users/lin/.m2/repository/org/hibernate/hibernate-core/4.3.5.Final/hibernate-core-4.3.5.Final.jar:/Users/lin/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar:/Users/lin/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar:/Users/lin/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.0.Final/jboss-transaction-api_1.2_spec-1.0.0.Final.jar:/Users/lin/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/Users/lin/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:/Users/lin/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.4.Final/hibernate-commons-annotations-4.0.4.Final.jar:/Users/lin/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar:/Users/lin/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar:/Users/lin/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/Users/lin/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar:/Users/lin/.m2/repository/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar:/Users/lin/.m2/repository/com/groupon/metrics/metricslib/1.0.2/metricslib-1.0.2.jar:/Users/lin/.m2/repository/com/codahale/metrics/metrics-core/3.0.0/metrics-core-3.0.0.jar:/Users/lin/.m2/repository/junit/junit/4.11/junit-4.11.jar:/Users/lin/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/lin/.m2/repository/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar:/Users/lin/.m2/repository/mysql/mysql-connector-mxj/5.0.11/mysql-connector-mxj-5.0.11.jar:/Users/lin/.m2/repository/mysql/mysql-connector-mxj-db/5.0.11/mysql-connector-mxj-db-5.0.11.jar:/Users/lin/.m2/repository/org/slf4j/slf4j-simple/1.7.7/slf4j-simple-1.7.7.jar:/Users/lin/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar:
My maven dependency tree: [INFO] +- org.hibernate:hibernate-core:jar:4.3.5.Final:compile [INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile [INFO] | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile [INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile [INFO] | +- dom4j:dom4j:jar:1.6.1:compile [INFO] | | \- xml-apis:xml-apis:jar:1.0.b2:compile [INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:compile [INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile [INFO] | +- org.javassist:javassist:jar:3.18.1-GA:compile [INFO] | +- antlr:antlr:jar:2.7.7:compile [INFO] | \- org.jboss:jandex:jar:1.1.0.Final:compile [INFO] +- mysql:mysql-connector-java:jar:5.1.30:compile [INFO] +- com.groupon.metrics:metricslib:jar:1.0.2:compile [INFO] | \- com.codahale.metrics:metrics-core:jar:3.0.0:compile [INFO] +- junit:junit:jar:4.11:test [INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test [INFO] +- commons-io:commons-io:jar:1.3.2:test [INFO] +- mysql:mysql-connector-mxj:jar:5.0.11:test [INFO] +- mysql:mysql-connector-mxj-db:jar:5.0.11:test [INFO] \- org.slf4j:slf4j-simple:jar:1.7.7:test [INFO] \- org.slf4j:slf4j-api:jar:1.7.7:compile
|