jbosslog4jjboss-eap-6jboss-logging

getRootLogger() equivalent in JBoss Logging


I am migrating an application from Weblogic to JBoss EAP 6.4. The application originally used Log4J and an external logging configuration properties file. From what I understand, using Log4J would require the log4j.xml or log4j.properties file to be packaged inside the EAR and it would prevent us from changing the logging configuration at runtime.

Currently, I am ok with using the JBoss Logging subsystem to do the logging. However, the application has calls like:

Logger rootLogger = Logger.getRootLogger();

What is the equivalent in JBoss Logging, if I needed to get the RootLogger?


Solution

  • You can use log4j essentially as a logging facade. In other words you don't need to change your logging code at all.

    If you want to use the logging subsystem for configuration just ensure your deployment does not have a log4j.xml or log4j.properties file as you stated.

    If you want to swap out log4j and use JBoss Logging the equivalent for Logger.getRootLogger() would just be Logger.getLogger("").