How to use JBoss logging using Hibernate?

I am writing a standalone java application using Hibernate. Maven brought me a library jboss-logging. I do not use JBoss. The question arises: can I register only with this library, or do I need to download some logging implementation, for example log4j?

+5
source share
3 answers

JBoss magazines are just a logging façade. To configure loggers, for example, use / add handlers, you need a log manager such as JBoss Log Manager, JUL log manager, logback or log4j.

JBoss Logging will try to discover which log manager is being used. You can specify which log manager you want to use with the system property org.jboss.logging.provider. Valid values ​​for `org.jboss.logging.provider 'are:

  • jboss - for JBoss log manager
  • jdk - for JUL log manager
  • log4j - for log4j log manager
  • slf4j - for a log with slf4j

Hibernate uses JBoss Logging for its i18n capabilities, vararg logging methods and the ability to not become attached to the log manager.

Of course, you can absolutely use JBoss Logging in your project. If you want to configure logging handlers, you also have to use the log manager.

+8
source

afaik, jboss-logging - api, , ​​ i18n ..

JBoss-logging (, SLF4J) .

, Java, JBoss-logging ( , ).

SLF4J ( LogBack Log4J) . http://slf4j.org

+1

Make sure that you have jboss-loggingand your implementation logger in your classpath, and set the system property org.jboss.logging.providerto log4j, jdk, slf4jor jboss, depending on what you want. In theory, automatic detection may also work.

https://github.com/jboss-logging/jboss-logging/blob/master/src/main/java/org/jboss/logging/LoggerProviders.java#L29

+1
source

All Articles