Search code examples
javaloggingundertowjboss-logging

How to set logging at runtime in org.jboss.logging


I am working with embedded undertow and using org.jboss.logging.Logger for logging. I cannot use log4j or slf4j since the application which is gonna use my jar might not be using different version of log4j and there might be some conflicts. And also since undertow already has jobss.logging in-built I do not want to add any dependency to my jar.

So, is there any way I can add the logging level at run time by passing the level as a parameter to a method or constructor?


Solution

  • JBoss Logging is just a logging facade like slf4j. You need a log manager to configure logging. JBoss Logging works with JUL, JBoss Log Manager, log4j, log4j2 and logback. If you don't have a log manager on your class path then JUL will be used.

    You can also define which log manager JBoss Logging should attempt to bind using the org.jboss.logging.provider system property. The valid values are:

    • jboss for the JBoss Log Manager
    • jdk for JUL
    • log4j2 for log4j2
    • log4j for log4j
    • slf4j for logback