How to switch Hibernate from jboss-logging to logback?

I found that my addiction to hibernation in turn caused an addiction to jboss-logging

.

Can I switch to the log logback

I'm already using?

UPDATE

I tried three places to install org.jboss.logging.provider

:

1). Approaching JPA properties in Spring:

.setJpaProperties(additionalProperties());

      

2) Setting the property to main()

:

System.setProperty("org.jboss.logging.provider", "slf4j");

      

3) setting the property on the command line:

-Dorg.jboss.logging.provider="slf4j"

      

Neither worked.

I am getting an exception:

Caused by: java.lang.ClassNotFoundException: org.jboss.logging.Logger
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 32 more

      

Please note that I have excluded the jboss entry from the dependencies:

 <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.7.Final</version>
        <exclusions>
            <exclusion>
                <groupId>org.jboss.logging</groupId>
                <artifactId>jboss-logging</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.jboss.logging</groupId>
                <artifactId>jboss-logging-annotations</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

      

+3


source to share


1 answer


I have set the property in the standalone.conf.bat file:

SET "JAVA_OPTS=%JAVA_OPTS% -Dorg.jboss.logging.provider=slf4j"

      

This Logger.class can be found in the jboss-logging jar at JBOSS_HOME \ modules \ org \ jboss \ logging \ main folder. This module exists by default.

I recently had a similar problem. I think you will run into this if you solve the Logger.class problem.



I got this exception:

ClassNotFoundException: org.slf4j.LoggerFactory from [Module "org.jboss.logging:main"

      

I added a dependency to slf4j in my JBOSS_HOME \ modules \ org \ jboss \ logging \ main \ module.xml

<module xmlns="urn:jboss:module:1.1" name="org.jboss.logging">
  <resources>
      <resource-root path="jboss-logging-3.1.0.GA.jar"/>
  </resources>

  <dependencies>
     <module name="org.jboss.logmanager"/>
     <module name="org.slf4j" slot="1.7.5" />
  </dependencies>
</module>

      

+2


source







All Articles