Reinstate the AbstractConfigTestBase.logConfiguration method
[controller.git] / opendaylight / config / config-it-base / src / main / java / org / opendaylight / controller / config / it / base / AbstractConfigTestBase.java
index 4d964eec607135d39ce62e5ed82df1e1a8f090cb..ee2cf1db7f69e714b630bca7e00b96a338801a6b 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.controller.config.it.base;
 
+import static org.ops4j.pax.exam.CoreOptions.composite;
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.when;
@@ -110,8 +111,13 @@ public abstract class AbstractConfigTestBase {
     public abstract String getFeatureName();
 
     public Option getLoggingOption() {
-        return editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG, logConfiguration(AbstractConfigTestBase.class),
-                LogLevel.INFO.name());
+        Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                "log4j2.logger.config-it-base.name",
+                AbstractConfigTestBase.class.getPackage().getName());
+        option = composite(option, editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                "log4j2.logger.config-it-base.level",
+                LogLevel.INFO.name()));
+        return option;
     }
 
     /**
@@ -123,6 +129,14 @@ public abstract class AbstractConfigTestBase {
         return null;
     }
 
+    /**
+     * Returns a Log4J logging configuration property name for the given class's package name of the form
+     * "log4j.logger.package_name".
+     *
+     * @deprecated The karaf logging provider is now Log4J2 so logging configurations must conform to the Log4J2 style.
+     *     This method is kept for compilation backwards compatibility but will be removed in a future release.
+     */
+    @Deprecated
     public String logConfiguration(final Class<?> klazz) {
         return "log4j.logger." + klazz.getPackage().getName();
     }
@@ -168,7 +182,7 @@ public abstract class AbstractConfigTestBase {
                 features(getFeatureRepo(), getFeatureName()),
                 mavenBundle("org.apache.aries.quiesce", "org.apache.aries.quiesce.api", "1.0.0"), getLoggingOption(),
                 mvnLocalRepoOption(),
-                editConfigurationFilePut(ETC_ORG_OPS4J_PAX_LOGGING_CFG, "log4j.rootLogger", "INFO, stdout, osgi:*") };
+                editConfigurationFilePut(ETC_ORG_OPS4J_PAX_LOGGING_CFG, "log4j2.rootLogger.level", "INFO") };
         return OptionUtils.combine(options, getAdditionalOptions());
     }