mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gaetan Boismal
27.44.2016 bd89ef81fe2c6e4ea39b61367f7d84d6756aafeb
OPENDJ-3140 Prevent dsconfig to log on the console

Last fix on dsconfig regarding this issue has the drawback to randomly
print the "Loaded extension" info message.
A solution is to completely disabling logging when configuration
framework classes are used by dsconfig.
1 files modified
9 ■■■■■ changed files
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java 9 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java
@@ -52,6 +52,8 @@
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import org.forgerock.i18n.LocalizableMessage;
@@ -785,7 +787,7 @@
     * @return Zero to indicate that the program completed successfully, or non-zero to indicate that an error occurred.
     */
    public static int main(String[] args, OutputStream outStream, OutputStream errStream) {
        disableConfigurationFrameworkConsoleLogging();
        disableLogging();
        final DSConfig app = new DSConfig(outStream, errStream);
        app.sessionStartTime = System.currentTimeMillis();
@@ -806,8 +808,9 @@
     * Prevent configuration framework to log on the console.
     * @see OPENDJ-3140 for more details.
     */
    private static void disableConfigurationFrameworkConsoleLogging() {
        Logger.getLogger("com.forgerock.opendj.ldap.config.config").setUseParentHandlers(false);
    private static void disableLogging() {
        LogManager.getLogManager().reset();
        Logger.getLogger("").setLevel(Level.OFF);
    }
    /** The factory which the application should use to retrieve its management context. */