Search code examples
javahibernateloggingjbossjboss-logging

How to use JBoss logging brought by Hibernate?


I am writing standalone java application which is using Hibernate. Maven brought jboss-logging library for me. I am not using JBoss. The question is: can I log with this library only, or I need to download some logging implementation like log4j?


Solution

  • JBoss Logging is just a logging facade. To configure your loggers, e.g. use/add handlers, you need a log manager like JBoss Log Manager, the J.U.L. log manager, logback or log4j.

    JBoss Logging will attempt to discover which log manager is being used. You can specify which log manager you'd like to use with the org.jboss.logging.provider system property. The allowed values for `org.jboss.logging.provider' are:

    • jboss - for JBoss Log Manager
    • jdk - For the J.U.L. log manager
    • log4j - For the log4j log manager
    • slf4j - For logback with slf4j

    Hibernate uses JBoss Logging for it's i18n capabilities, it's vararg logging methods and the ability to not be tied to a log manager.

    Of course you can absolutely use JBoss Logging in your project. If you want to configure logging handlers you'd also have to use a log manager as well.