freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [1/2] incubator-freemarker git commit: Removed freemarker.ext.log, our log abstraction layer from the old times when there was no clear winner on this field. Added org.slf4j:slf4j-api as required dependency instead.
Date Fri, 20 Jan 2017 21:32:21 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 1588a7f5a -> 8952cbbba


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/CommonsLoggingLoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/CommonsLoggingLoggerFactory.java b/src/main/java/freemarker/log/CommonsLoggingLoggerFactory.java
deleted file mode 100644
index e157d41..0000000
--- a/src/main/java/freemarker/log/CommonsLoggingLoggerFactory.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-/**
- * @deprecated Don't use it, meant to be internal.
- */
-// 2.4: Remove
-@Deprecated
-public class CommonsLoggingLoggerFactory implements LoggerFactory {
-
-    public Logger getLogger(String category) {
-            return new CommonsLoggingLogger(
-                            org.apache.commons.logging.LogFactory.getLog(category));
-    }
-    
-    static private class CommonsLoggingLogger extends Logger {
-
-            private final org.apache.commons.logging.Log logger;
-            
-            CommonsLoggingLogger(org.apache.commons.logging.Log logger) {
-                    this.logger = logger;
-            }
-            
-            @Override
-            public void debug(String message) {
-                    logger.debug(message);
-            }
-
-            @Override
-            public void debug(String message, Throwable t) {
-                    logger.debug(message, t);
-            }
-
-            @Override
-            public void info(String message) {
-                    logger.info(message);
-            }
-
-            @Override
-            public void info(String message, Throwable t) {
-                    logger.info(message, t);
-            }
-
-            @Override
-            public void warn(String message) {
-                    logger.warn(message);
-            }
-
-            @Override
-            public void warn(String message, Throwable t) {
-                    logger.warn(message, t);
-            }
-
-            @Override
-            public void error(String message) {
-                    logger.error(message);
-            }
-
-            @Override
-            public void error(String message, Throwable t) {
-                    logger.error(message, t);
-            }
-
-            @Override
-            public boolean isDebugEnabled() {
-                    return logger.isDebugEnabled();
-            }
-
-            @Override
-            public boolean isInfoEnabled() {
-                    return logger.isInfoEnabled();
-            }
-
-            @Override
-            public boolean isWarnEnabled() {
-                    return logger.isWarnEnabled();
-            }
-
-            @Override
-            public boolean isErrorEnabled() {
-                    return logger.isErrorEnabled();
-            }
-
-            @Override
-            public boolean isFatalEnabled() {
-                    return logger.isFatalEnabled();
-            }
-            
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/Logger.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/Logger.java b/src/main/java/freemarker/log/Logger.java
deleted file mode 100644
index a084fb0..0000000
--- a/src/main/java/freemarker/log/Logger.java
+++ /dev/null
@@ -1,580 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Delegates logger creation to an actual logging library. By default it looks for logger libraries in this order (in
- * FreeMarker 2.3.x): Log4J, Avalon LogKit, JUL (i.e., <tt>java.util.logging</tt>). Prior to FreeMarker 2.4, SLF4J and
- * Apache Commons Logging aren't searched automatically due to backward compatibility constraints. But if you have
- * {@code log4j-over-slf4j} properly installed (means, you have no real Log4j in your class path, and SLF4J has a
- * backing implementation like {@code logback-classic}), then FreeMarker will use SLF4J directly instead of Log4j (since
- * FreeMarker 2.3.22).
- * 
- * <p>
- * If the auto detection sequence describet above doesn't give you the result that you want, see
- * {@link #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY}.
- */
-public abstract class Logger {
-
-    /**
-     * The {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} system property is used to select a logger library explicitly,
-     * rather than relying on automatic selection. You meant to set this system property where the JVM is started, like
-     * {@code java ... -Dorg.freemarker.loggerLibrary=SLF4j}. Setting it from Java code isn't reliable, also it can
-     * cause confusion if you override the value set by others with {@code -D}.
-     * 
-     * <p>
-     * If the requested logging library is not available, an error will be printed to the stderr, then logging will be
-     * disabled.
-     * 
-     * <p>
-     * The supported values are:
-     * <ul>
-     * <li>{@value #LIBRARY_NAME_SLF4J}: Use SLF4J (recommended)</li>
-     * <li>{@value #LIBRARY_NAME_COMMONS_LOGGING}: Use Apache Commons Logging.</li>
-     * <li>{@value #LIBRARY_NAME_LOG4J}: Use Log4j.</li>
-     * <li>{@value #LIBRARY_NAME_JUL}: Use {@code java.util.logging}.</li>
-     * <li>{@value #LIBRARY_NAME_AVALON}: Use Avalon LogKit (deprecated)</li>
-     * <li>{@value #LIBRARY_NAME_AUTO}: Use automatic selection (default behavior). See {@link Logger} class
-     * documentation for more.</li>
-     * <li>{@value #LIBRARY_NAME_NONE}: Don't log.</li>
-     * </ul>
-     * 
-     * @since 2.3.22
-     */
-    public static final String SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY = "org.freemarker.loggerLibrary";
-
-    /**
-     * Enum value used for {@link #selectLoggerLibrary(int)}; indicates auto-selection as described in the class
-     * documentation of {@link #Logger()}.
-     */
-    public static final int LIBRARY_AUTO = -1;
-    private static final int MIN_LIBRARY_ENUM = LIBRARY_AUTO;
-
-    /**
-     * {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} property value; indicates auto-selection as described in the class
-     * documentation of {@link #Logger()}. @since 2.3.22
-     */
-    public static final String LIBRARY_NAME_AUTO = "auto";
-
-    /**
-     * Enum value used for {@link #selectLoggerLibrary(int)}; indicates that no logging should occur.
-     */
-    public static final int LIBRARY_NONE = 0;
-
-    /**
-     * {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} property value; indicates that no logging should occur. @since
-     * 2.3.22
-     */
-    public static final String LIBRARY_NAME_NONE = "none";
-
-    /**
-     * Enum value used for {@link #selectLoggerLibrary(int)}; indicates that {@code java.util.logging} should be used.
-     */
-    public static final int LIBRARY_JAVA = 1;
-
-    /**
-     * {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} property value; indicates that {@code java.util.logging} should be
-     * used. @since 2.3.22
-     */
-    public static final String LIBRARY_NAME_JUL = "JUL";
-
-    /**
-     * Enum value used for {@link #selectLoggerLibrary(int)}; indicates that Avalon LogKit should be used.
-     * 
-     * @deprecated Avalon LogKit support will be removed sometimes in the future.
-     */
-    @Deprecated
-    public static final int LIBRARY_AVALON = 2;
-
-    /**
-     * {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} property value; indicates that Avalon LogKit should be used. @since
-     * 2.3.22
-     * 
-     * @deprecated Avalon LogKit support will be removed sometimes in the future.
-     */
-    // This value is also used as part of the factory class name.
-    @Deprecated
-    public static final String LIBRARY_NAME_AVALON = "Avalon";
-
-    /**
-     * Enum value used for {@link #selectLoggerLibrary(int)}; indicates that Log4J should be used.
-     */
-    public static final int LIBRARY_LOG4J = 3;
-
-    /**
-     * {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} property value; indicates that Log4J should be used. @since 2.3.22
-     */
-    // This value is also used as part of the factory class name.
-    public static final String LIBRARY_NAME_LOG4J = "Log4j";
-
-    /**
-     * Enum value used for {@link #selectLoggerLibrary(int)}; indicates that Apache commons-logging should be used.
-     */
-    public static final int LIBRARY_COMMONS = 4;
-
-    /**
-     * {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} property value; indicates that Apache commons-logging should be
-     * used. @since 2.3.22
-     */
-    // This value is also used as part of the factory class name.
-    public static final String LIBRARY_NAME_COMMONS_LOGGING = "CommonsLogging";
-
-    /**
-     * Constant used with {@link #selectLoggerLibrary(int)}; indicates that SLF4J should be used.
-     */
-    public static final int LIBRARY_SLF4J = 5;
-
-    /**
-     * {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} property value; indicates that SLF4J should be used. @since 2.3.22
-     */
-    // This value is also used as part of the factory class name.
-    public static final String LIBRARY_NAME_SLF4J = "SLF4J";
-    private static final int MAX_LIBRARY_ENUM = LIBRARY_SLF4J;
-
-    private static final String REAL_LOG4J_PRESENCE_CLASS = "org.apache.log4j.FileAppender";
-    private static final String LOG4J_OVER_SLF4J_TESTER_CLASS = "freemarker.log._Log4jOverSLF4JTester";
-
-    /**
-     * Order matters! Starts with the lowest priority.
-     */
-    private static final String[] LIBRARIES_BY_PRIORITY = {
-            null, LIBRARY_NAME_JUL,
-            "org.apache.log.Logger", LIBRARY_NAME_AVALON,
-            "org.apache.log4j.Logger", LIBRARY_NAME_LOG4J,
-            /* In 2.3.x this two is skipped by LIBRARY_AUTO: */
-            "org.apache.commons.logging.Log", LIBRARY_NAME_COMMONS_LOGGING,
-            "org.slf4j.Logger", LIBRARY_NAME_SLF4J,
-    };
-
-    private static String getAvailabilityCheckClassName(int libraryEnum) {
-        if (libraryEnum == LIBRARY_AUTO || libraryEnum == LIBRARY_NONE) {
-            // Statically linked
-            return null;
-        }
-        return LIBRARIES_BY_PRIORITY[(libraryEnum - 1) * 2];
-    }
-
-    static {
-        if (LIBRARIES_BY_PRIORITY.length / 2 != MAX_LIBRARY_ENUM) {
-            throw new AssertionError();
-        }
-    }
-
-    private static String getLibraryName(int libraryEnum) {
-        if (libraryEnum == LIBRARY_AUTO) {
-            return LIBRARY_NAME_AUTO;
-        }
-        if (libraryEnum == LIBRARY_NONE) {
-            return LIBRARY_NAME_NONE;
-        }
-        return LIBRARIES_BY_PRIORITY[(libraryEnum - 1) * 2 + 1];
-    }
-
-    private static boolean isAutoDetected(int libraryEnum) {
-        // 2.4: Remove libraryEnum == LIBRARY_SLF4J || libraryEnum == LIBRARY_COMMONS
-        return !(libraryEnum == LIBRARY_AUTO || libraryEnum == LIBRARY_NONE
-                || libraryEnum == LIBRARY_SLF4J || libraryEnum == LIBRARY_COMMONS);
-    }
-
-    private static int libraryEnum;
-    private static LoggerFactory loggerFactory;
-    private static boolean initializedFromSystemProperty;
-
-    private static String categoryPrefix = "";
-
-    private static final Map loggersByCategory = new HashMap();
-
-    /**
-     * Selects the logger library to use, unless it's already specified by the
-     * {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} system property. Call this early in application initialization
-     * phase, before calling any other FreeMarker API-s, since once parts of the FreeMarker library bind to the logging
-     * subsystem, the change in this value will have no effect on them.
-     * 
-     * @param libraryEnum
-     *            One of <tt>LIBRARY_...</tt> constants. By default, {@link #LIBRARY_AUTO} is used.
-     * 
-     * @throws ClassNotFoundException
-     *             if an explicit logging library is asked for (that is, not {@value #LIBRARY_AUTO} or
-     *             {@value #LIBRARY_NONE}) and it's not found in the classpath.
-     * 
-     * @deprecated This method isn't reliable, unless you can somehow ensure that you access the FreeMarker classes
-     *             first; use the {@value #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} Java system property instead, like
-     *             {@code java ... -Dorg.freemarker.loggerLibrary=slf4j}. See
-     *             {@link #SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY} for more.
-     */
-    @Deprecated
-    public static void selectLoggerLibrary(int libraryEnum) throws ClassNotFoundException {
-        if (libraryEnum < MIN_LIBRARY_ENUM || libraryEnum > MAX_LIBRARY_ENUM) {
-            throw new IllegalArgumentException("Library enum value out of range");
-        }
-
-        synchronized (Logger.class) {
-            final boolean loggerFactoryWasAlreadySet = loggerFactory != null;
-            if (!loggerFactoryWasAlreadySet || libraryEnum != Logger.libraryEnum) {
-                // Creates the factory only if it can be done based on system property:
-                ensureLoggerFactorySet(true);
-
-                // The system property has precedence because this method was deprecated by it:
-                if (!initializedFromSystemProperty || loggerFactory == null) {
-                    int replacedLibraryEnum = Logger.libraryEnum;
-                    setLibrary(libraryEnum);
-                    loggersByCategory.clear();
-                    if (loggerFactoryWasAlreadySet) {
-                        logWarnInLogger("Logger library was already set earlier to \""
-                                + getLibraryName(replacedLibraryEnum) + "\"; "
-                                + "change to \"" + getLibraryName(libraryEnum) + "\" won't effect loggers created "
-                                + "earlier.");
-                    }
-                } else if (libraryEnum != Logger.libraryEnum) {
-                    logWarnInLogger("Ignored " + Logger.class.getName() + ".selectLoggerLibrary(\""
-                            + getLibraryName(libraryEnum)
-                            + "\") call, because the \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY
-                            + "\" system property is set to \"" + getLibraryName(Logger.libraryEnum) + "\".");
-                }
-            }
-        }
-    }
-
-    /**
-     * Sets a category prefix. This prefix is prepended to any logger category name. This makes it possible to have
-     * different FreeMarker logger categories on a per-application basis (better said, per-classloader basis). By
-     * default the category prefix is the empty string. If you set a non-empty category prefix, be sure to include the
-     * trailing separator dot (i.e. "MyApp.") If you want to change the default setting, do it early in application
-     * initialization phase, before calling any other FreeMarker API since once various parts of the FreeMarker library
-     * bind to the logging subsystem, the change in this value will have no effect on them.
-     * 
-     * @deprecated This wasn't reliable, unless you can somehow ensure that you access the FreeMarker classes first. As
-     *             it's not known to be useful for users, consider it removed.
-     */
-    @Deprecated
-    public static void setCategoryPrefix(String prefix) {
-        synchronized (Logger.class) {
-            if (prefix == null) {
-                throw new IllegalArgumentException();
-            }
-            categoryPrefix = prefix;
-        }
-    }
-
-    /**
-     * Logs a debugging message.
-     */
-    public abstract void debug(String message);
-
-    /**
-     * Logs a debugging message with accompanying throwable.
-     */
-    public abstract void debug(String message, Throwable t);
-
-    /**
-     * Logs an informational message.
-     */
-    public abstract void info(String message);
-
-    /**
-     * Logs an informational message with accompanying throwable.
-     */
-    public abstract void info(String message, Throwable t);
-
-    /**
-     * Logs a warning message.
-     */
-    public abstract void warn(String message);
-
-    /**
-     * Logs a warning message with accompanying throwable.
-     */
-    public abstract void warn(String message, Throwable t);
-
-    /**
-     * Logs an error message.
-     */
-    public abstract void error(String message);
-
-    /**
-     * Logs an error message with accompanying throwable.
-     */
-    public abstract void error(String message, Throwable t);
-
-    /**
-     * Returns true if this logger will log debug messages.
-     */
-    public abstract boolean isDebugEnabled();
-
-    /**
-     * Returns true if this logger will log informational messages.
-     */
-    public abstract boolean isInfoEnabled();
-
-    /**
-     * Returns true if this logger will log warning messages.
-     */
-    public abstract boolean isWarnEnabled();
-
-    /**
-     * Returns true if this logger will log error messages.
-     */
-    public abstract boolean isErrorEnabled();
-
-    /**
-     * Returns true if this logger will log fatal error messages.
-     */
-    public abstract boolean isFatalEnabled();
-
-    /**
-     * Returns a logger for the specified category.
-     * 
-     * @param category
-     *            a dot separated hierarchical category name. If a category prefix is in effect, it's prepended to the
-     *            category name.
-     */
-    public static Logger getLogger(String category) {
-        if (categoryPrefix.length() != 0) {
-            category = categoryPrefix + category;
-        }
-        synchronized (loggersByCategory) {
-            Logger logger = (Logger) loggersByCategory.get(category);
-            if (logger == null) {
-                ensureLoggerFactorySet(false);
-                logger = loggerFactory.getLogger(category);
-                loggersByCategory.put(category, logger);
-            }
-            return logger;
-        }
-    }
-
-    private static void ensureLoggerFactorySet(boolean onlyIfCanBeSetFromSysProp) {
-        if (loggerFactory != null) return;
-        synchronized (Logger.class) {
-            if (loggerFactory != null) return;
-
-            String sysPropVal = getSystemProperty(SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY);
-
-            final int libraryEnum;
-            if (sysPropVal != null) {
-                sysPropVal = sysPropVal.trim();
-
-                boolean foundMatch = false;
-                int matchedEnum = MIN_LIBRARY_ENUM;
-                do {
-                    if (sysPropVal.equalsIgnoreCase(getLibraryName(matchedEnum))) {
-                        foundMatch = true;
-                    } else {
-                        matchedEnum++;
-                    }
-                } while (matchedEnum <= MAX_LIBRARY_ENUM && !foundMatch);
-
-                if (!foundMatch) {
-                    logWarnInLogger("Ignored invalid \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY
-                            + "\" system property value: \"" + sysPropVal + "\"");
-                    if (onlyIfCanBeSetFromSysProp) return;
-                }
-
-                libraryEnum = foundMatch ? matchedEnum : LIBRARY_AUTO;
-            } else {
-                if (onlyIfCanBeSetFromSysProp) return;
-                libraryEnum = LIBRARY_AUTO;
-            }
-
-            try {
-                setLibrary(libraryEnum);
-                if (sysPropVal != null) {
-                    initializedFromSystemProperty = true;
-                }
-            } catch (Throwable e) {
-                final boolean disableLogging = !(onlyIfCanBeSetFromSysProp && sysPropVal != null);
-                logErrorInLogger(
-                        "Couldn't set up logger for \"" + getLibraryName(libraryEnum) + "\""
-                                + (disableLogging ? "; logging disabled" : "."), e);
-                if (disableLogging) {
-                    try {
-                        setLibrary(LIBRARY_NONE);
-                    } catch (ClassNotFoundException e2) {
-                        throw new RuntimeException("Bug", e2);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * @throws ClassNotFoundException
-     *             If the requested logger library is not available. Never thrown for {@link #LIBRARY_AUTO}.
-     */
-    private static LoggerFactory createLoggerFactory(int libraryEnum) throws ClassNotFoundException {
-        if (libraryEnum == LIBRARY_AUTO) {
-            for (int libraryEnumToTry = MAX_LIBRARY_ENUM; libraryEnumToTry >= MIN_LIBRARY_ENUM; libraryEnumToTry--) {
-                if (!isAutoDetected(libraryEnumToTry)) continue;
-                if (libraryEnumToTry == LIBRARY_LOG4J && hasLog4LibraryThatDelegatesToWorkingSLF4J()) {
-                    libraryEnumToTry = LIBRARY_SLF4J;
-                }
-
-                try {
-                    return createLoggerFactoryForNonAuto(libraryEnumToTry);
-                } catch (ClassNotFoundException e) {
-                    // Expected, intentionally suppressed.
-                } catch (Throwable e) {
-                    logErrorInLogger(
-                            "Unexpected error when initializing logging for \""
-                                    + getLibraryName(libraryEnumToTry) + "\".",
-                            e);
-                }
-            }
-            logWarnInLogger("Auto detecton couldn't set up any logger libraries; FreeMarker logging suppressed.");
-            return new _NullLoggerFactory();
-        } else {
-            return createLoggerFactoryForNonAuto(libraryEnum);
-        }
-    }
-
-    /**
-     * @throws ClassNotFoundException
-     *             If the required logger library is not available.
-     */
-    private static LoggerFactory createLoggerFactoryForNonAuto(int libraryEnum) throws ClassNotFoundException {
-        final String availabilityCheckClassName = getAvailabilityCheckClassName(libraryEnum);
-        if (availabilityCheckClassName != null) { // Dynamically created factory
-            Class.forName(availabilityCheckClassName);
-            String libraryName = getLibraryName(libraryEnum);
-            try {
-                return (LoggerFactory) Class.forName(
-                        "freemarker.log._" + libraryName + "LoggerFactory").newInstance();
-            } catch (Exception e) {
-                throw new RuntimeException(
-                        "Unexpected error when creating logger factory for \"" + libraryName + "\".", e);
-            }
-        } else { // Non-dynamically created factory
-            if (libraryEnum == LIBRARY_JAVA) {
-                return new _JULLoggerFactory();
-            } else if (libraryEnum == LIBRARY_NONE) {
-                return new _NullLoggerFactory();
-            } else {
-                throw new RuntimeException("Bug");
-            }
-        }
-    }
-
-    private static boolean hasLog4LibraryThatDelegatesToWorkingSLF4J() {
-        try {
-            Class.forName(getAvailabilityCheckClassName(LIBRARY_LOG4J));
-            Class.forName(getAvailabilityCheckClassName(LIBRARY_SLF4J));
-        } catch (Throwable e) {
-            return false;
-        }
-        try {
-            Class.forName(REAL_LOG4J_PRESENCE_CLASS);
-            return false;
-        } catch (ClassNotFoundException e) {
-            try {
-                Object r = Class.forName(LOG4J_OVER_SLF4J_TESTER_CLASS)
-                        .getMethod("test", new Class[] {}).invoke(null);
-                return ((Boolean) r).booleanValue();
-            } catch (Throwable e2) {
-                return false;
-            }
-        }
-    }
-
-    private synchronized static void setLibrary(int libraryEnum) throws ClassNotFoundException {
-        loggerFactory = createLoggerFactory(libraryEnum);
-        Logger.libraryEnum = libraryEnum;
-    }
-
-    private static void logWarnInLogger(String message) {
-        logInLogger(false, message, null);
-    }
-
-    private static void logErrorInLogger(String message, Throwable exception) {
-        logInLogger(true, message, exception);
-    }
-
-    private static void logInLogger(boolean error, String message, Throwable exception) {
-        boolean canUseRealLogger;
-        synchronized (Logger.class) {
-            canUseRealLogger = loggerFactory != null && !(loggerFactory instanceof _NullLoggerFactory);
-        }
-
-        if (canUseRealLogger) {
-            try {
-                final Logger logger = Logger.getLogger("freemarker.logger");
-                if (error) {
-                    logger.error(message);
-                } else {
-                    logger.warn(message);
-                }
-            } catch (Throwable e) {
-                canUseRealLogger = false;
-            }
-        }
-
-        if (!canUseRealLogger) {
-            System.err.println((error ? "ERROR" : "WARN") + " "
-                    + LoggerFactory.class.getName() + ": " + message);
-            if (exception != null) {
-                System.err.println("\tException: " + tryToString(exception));
-                while (exception.getCause() != null) {
-                    exception = exception.getCause();
-                    System.err.println("\tCaused by: " + tryToString(exception));
-                }
-            }
-        }
-    }
-
-    /**
-     * Don't use {@link freemarker.template.utility.SecurityUtilities#getSystemProperty(String, String)} here, as it
-     * (might) depends on the logger, hence interfering with the initialization.
-     */
-    private static String getSystemProperty(final String key) {
-        try {
-            return (String) AccessController.doPrivileged(
-                    new PrivilegedAction() {
-                        public Object run() {
-                            return System.getProperty(key, null);
-                        }
-                    });
-        } catch (AccessControlException e) {
-            logWarnInLogger("Insufficient permissions to read system property \"" + key + "\".");
-            return null;
-        } catch (Throwable e) {
-            logErrorInLogger("Failed to read system property \"" + key + "\".", e);
-            return null;
-        }
-    }
-
-    /**
-     * Don't use {@link freemarker.template.utility.StringUtil#tryToString(Object)} here, as it might depends on the
-     * logger, hence interfering with the initialization.
-     */
-    private static String tryToString(Object object) {
-        if (object == null) return null;
-        try {
-            return object.toString();
-        } catch (Throwable e) {
-            return object.getClass().getName();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/LoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/LoggerFactory.java b/src/main/java/freemarker/log/LoggerFactory.java
deleted file mode 100644
index 5c4acef..0000000
--- a/src/main/java/freemarker/log/LoggerFactory.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-interface LoggerFactory {
-    public Logger getLogger(String category);
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/SLF4JLoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/SLF4JLoggerFactory.java b/src/main/java/freemarker/log/SLF4JLoggerFactory.java
deleted file mode 100644
index d0efbf2..0000000
--- a/src/main/java/freemarker/log/SLF4JLoggerFactory.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-import org.slf4j.spi.LocationAwareLogger;
-
-/**
- * @deprecated Don't use it, meant to be internal.
- */
-// 2.4: Remove
-@Deprecated
-public class SLF4JLoggerFactory implements LoggerFactory {
-
-    public Logger getLogger(String category) {
-            org.slf4j.Logger slf4jLogger = org.slf4j.LoggerFactory.getLogger(category);
-            if (slf4jLogger instanceof LocationAwareLogger) {
-                    return new LocationAwareSLF4JLogger((LocationAwareLogger) slf4jLogger);
-            } else {
-                    return new LocationUnawareSLF4JLogger(slf4jLogger);
-            }
-    }
-
-    /**
-     * Logger where the log entry issuer (class, method) will be correctly
-     * shown to be the caller of <tt>LocationAwareSLF4JLogger</tt> methods.
-     */
-    private static final class LocationAwareSLF4JLogger extends Logger {
-            
-            private static final String ADAPTER_FQCN
-                            = LocationAwareSLF4JLogger.class.getName();
-            
-            private final LocationAwareLogger logger;
-            
-            LocationAwareSLF4JLogger(LocationAwareLogger logger) {
-                    this.logger = logger;
-            }
-
-            @Override
-            public void debug(String message) {
-                    debug(message, null);
-            }
-
-            @Override
-            public void debug(String message, Throwable t) {
-                    logger.log(null, ADAPTER_FQCN,
-                                    LocationAwareLogger.DEBUG_INT, message, null, t);
-            }
-
-            @Override
-            public void info(String message) {
-                    info(message, null);
-            }
-
-            @Override
-            public void info(String message, Throwable t) {
-                    logger.log(null, ADAPTER_FQCN,
-                                    LocationAwareLogger.INFO_INT, message, null, t);
-            }
-
-            @Override
-            public void warn(String message) {
-                    warn(message, null);
-            }
-
-            @Override
-            public void warn(String message, Throwable t) {
-                    logger.log(null, ADAPTER_FQCN,
-                                    LocationAwareLogger.WARN_INT, message, null, t);
-            }
-
-            @Override
-            public void error(String message) {
-                    error(message, null);
-            }
-
-            @Override
-            public void error(String message, Throwable t) {
-                    logger.log(null, ADAPTER_FQCN,
-                                    LocationAwareLogger.ERROR_INT, message, null, t);
-            }
-
-            @Override
-            public boolean isDebugEnabled() {
-                    return logger.isDebugEnabled();
-            }
-
-            @Override
-            public boolean isInfoEnabled() {
-                    return logger.isInfoEnabled();
-            }
-
-            @Override
-            public boolean isWarnEnabled() {
-                    return logger.isWarnEnabled();
-            }
-
-            @Override
-            public boolean isErrorEnabled() {
-                    return logger.isErrorEnabled();
-            }
-
-            @Override
-            public boolean isFatalEnabled() {
-                    return logger.isErrorEnabled();
-            }
-            
-    }
-    
-    /**
-     * Logger where the log entry issuer (class, method) will be incorrectly
-     * shown to be a method of this class.
-     */
-    private static class LocationUnawareSLF4JLogger extends Logger {
-            
-            private final org.slf4j.Logger logger;
-
-            LocationUnawareSLF4JLogger(org.slf4j.Logger logger) {
-                    this.logger = logger;
-            }
-
-            @Override
-            public void debug(String message) {
-                    logger.debug(message);
-            }
-
-            @Override
-            public void debug(String message, Throwable t) {
-                    logger.debug(message, t);
-            }
-
-            @Override
-            public void info(String message) {
-                    logger.info(message);
-            }
-
-            @Override
-            public void info(String message, Throwable t) {
-                    logger.info(message, t);
-            }
-
-            @Override
-            public void warn(String message) {
-                    logger.warn(message);
-            }
-
-            @Override
-            public void warn(String message, Throwable t) {
-                    logger.warn(message, t);
-            }
-
-            @Override
-            public void error(String message) {
-                    logger.error(message);
-            }
-
-            @Override
-            public void error(String message, Throwable t) {
-                    logger.error(message, t);
-            }
-
-            @Override
-            public boolean isDebugEnabled() {
-                    return logger.isDebugEnabled();
-            }
-
-            @Override
-            public boolean isInfoEnabled() {
-                    return logger.isInfoEnabled();
-            }
-
-            @Override
-            public boolean isWarnEnabled() {
-                    return logger.isWarnEnabled();
-            }
-
-            @Override
-            public boolean isErrorEnabled() {
-                    return logger.isErrorEnabled();
-            }
-
-            @Override
-            public boolean isFatalEnabled() {
-                    return logger.isErrorEnabled();
-            }
-            
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/_AvalonLoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/_AvalonLoggerFactory.java b/src/main/java/freemarker/log/_AvalonLoggerFactory.java
deleted file mode 100644
index 9e274b1..0000000
--- a/src/main/java/freemarker/log/_AvalonLoggerFactory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-import org.apache.log.Hierarchy;
-
-/**
- * Don't use this class; it's only public to work around Google App Engine Java
- * compliance issues. FreeMarker developers only: treat this class as package-visible.
- */
-public class _AvalonLoggerFactory implements LoggerFactory {
-    public Logger getLogger(String category) {
-        return new AvalonLogger(Hierarchy.getDefaultHierarchy().getLoggerFor(category));
-    }
-
-    private static class AvalonLogger
-    extends
-        Logger {
-        private final org.apache.log.Logger logger;
-        
-        AvalonLogger(org.apache.log.Logger logger) {
-            this.logger = logger;
-        }
-        
-        @Override
-        public void debug(String message) {
-            logger.debug(message);
-        }
-
-        @Override
-        public void debug(String message, Throwable t) {
-            logger.debug(message, t);
-        }
-
-        @Override
-        public void error(String message) {
-            logger.error(message);
-        }
-
-        @Override
-        public void error(String message, Throwable t) {
-            logger.error(message, t);
-        }
-
-        @Override
-        public void info(String message) {
-            logger.info(message);
-        }
-
-        @Override
-        public void info(String message, Throwable t) {
-            logger.info(message, t);
-        }
-
-        @Override
-        public void warn(String message) {
-            logger.warn(message);
-        }
-
-        @Override
-        public void warn(String message, Throwable t) {
-            logger.warn(message, t);
-        }
-
-        @Override
-        public boolean isDebugEnabled() {
-            return logger.isDebugEnabled();
-        }
-
-        @Override
-        public boolean isInfoEnabled() {
-            return logger.isInfoEnabled();
-        }
-
-        @Override
-        public boolean isWarnEnabled() {
-            return logger.isWarnEnabled();
-        }
-
-        @Override
-        public boolean isErrorEnabled() {
-            return logger.isErrorEnabled();
-        }
-
-        @Override
-        public boolean isFatalEnabled() {
-            return logger.isFatalErrorEnabled();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/_CommonsLoggingLoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/_CommonsLoggingLoggerFactory.java b/src/main/java/freemarker/log/_CommonsLoggingLoggerFactory.java
deleted file mode 100644
index 551aa52..0000000
--- a/src/main/java/freemarker/log/_CommonsLoggingLoggerFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-/**
- * Don't use this class; it's only public to work around Google App Engine Java
- * compliance issues. FreeMarker developers only: treat this class as package-visible.
- */
-public class _CommonsLoggingLoggerFactory extends CommonsLoggingLoggerFactory {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/_JULLoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/_JULLoggerFactory.java b/src/main/java/freemarker/log/_JULLoggerFactory.java
deleted file mode 100644
index 7eb11b3..0000000
--- a/src/main/java/freemarker/log/_JULLoggerFactory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-import java.util.logging.Level;
-
-/**
- * Don't use this class; it's only public to work around Google App Engine Java
- * compliance issues. FreeMarker developers only: treat this class as package-visible.
- */
-public class _JULLoggerFactory implements LoggerFactory {
-    public Logger getLogger(String category) {
-        return new JULLogger(java.util.logging.Logger.getLogger(category));
-    }
-
-    private static class JULLogger
-    extends
-        Logger {
-        private final java.util.logging.Logger logger;
-        
-        JULLogger(java.util.logging.Logger logger) {
-            this.logger = logger;
-        }
-        
-        @Override
-        public void debug(String message) {
-            logger.log(Level.FINE, message);
-        }
-
-        @Override
-        public void debug(String message, Throwable t) {
-            logger.log(Level.FINE, message, t);
-        }
-
-        @Override
-        public void error(String message) {
-            logger.log(Level.SEVERE, message);
-        }
-
-        @Override
-        public void error(String message, Throwable t) {
-            logger.log(Level.SEVERE, message, t);
-        }
-
-        @Override
-        public void info(String message) {
-            logger.log(Level.INFO, message);
-        }
-
-        @Override
-        public void info(String message, Throwable t) {
-            logger.log(Level.INFO, message, t);
-        }
-
-        @Override
-        public void warn(String message) {
-            logger.log(Level.WARNING, message);
-        }
-
-        @Override
-        public void warn(String message, Throwable t) {
-            logger.log(Level.WARNING, message, t);
-        }
-
-        @Override
-        public boolean isDebugEnabled() {
-            return logger.isLoggable(Level.FINE);
-        }
-
-        @Override
-        public boolean isInfoEnabled() {
-            return logger.isLoggable(Level.INFO);
-        }
-
-        @Override
-        public boolean isWarnEnabled() {
-            return logger.isLoggable(Level.WARNING);
-        }
-
-        @Override
-        public boolean isErrorEnabled() {
-            return logger.isLoggable(Level.SEVERE);
-        }
-
-        @Override
-        public boolean isFatalEnabled() {
-            return logger.isLoggable(Level.SEVERE);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/_Log4jLoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/_Log4jLoggerFactory.java b/src/main/java/freemarker/log/_Log4jLoggerFactory.java
deleted file mode 100644
index d78a164..0000000
--- a/src/main/java/freemarker/log/_Log4jLoggerFactory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-import org.apache.log4j.Level;
-
-/**
- * Don't use this class; it's only public to work around Google App Engine Java
- * compliance issues. FreeMarker developers only: treat this class as package-visible.
- */
-public class _Log4jLoggerFactory implements LoggerFactory {
-    public Logger getLogger(String category) {
-        return new Log4jLogger(org.apache.log4j.Logger.getLogger(category));
-    }
-
-    private static class Log4jLogger
-    extends
-        Logger {
-        private final org.apache.log4j.Logger logger;
-        
-        Log4jLogger(org.apache.log4j.Logger logger) {
-            this.logger = logger;
-        }
-        
-        @Override
-        public void debug(String message) {
-            logger.debug(message);
-        }
-
-        @Override
-        public void debug(String message, Throwable t) {
-            logger.debug(message, t);
-        }
-
-        @Override
-        public void error(String message) {
-            logger.error(message);
-        }
-
-        @Override
-        public void error(String message, Throwable t) {
-            logger.error(message, t);
-        }
-
-        @Override
-        public void info(String message) {
-            logger.info(message);
-        }
-
-        @Override
-        public void info(String message, Throwable t) {
-            logger.info(message, t);
-        }
-
-        @Override
-        public void warn(String message) {
-            logger.warn(message);
-        }
-
-        @Override
-        public void warn(String message, Throwable t) {
-            logger.warn(message, t);
-        }
-
-        @Override
-        public boolean isDebugEnabled() {
-            return logger.isDebugEnabled();
-        }
-
-        @Override
-        public boolean isInfoEnabled() {
-            return logger.isInfoEnabled();
-        }
-
-        @Override
-        public boolean isWarnEnabled() {
-            return logger.isEnabledFor(Level.WARN);
-        }
-
-        @Override
-        public boolean isErrorEnabled() {
-            return logger.isEnabledFor(Level.ERROR);
-        }
-
-        @Override
-        public boolean isFatalEnabled() {
-            return logger.isEnabledFor(Level.FATAL);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/_Log4jOverSLF4JTester.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/_Log4jOverSLF4JTester.java b/src/main/java/freemarker/log/_Log4jOverSLF4JTester.java
deleted file mode 100644
index 5afcadf..0000000
--- a/src/main/java/freemarker/log/_Log4jOverSLF4JTester.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-/**
- * Don't use this class; it's only public to work around Google App Engine Java
- * compliance issues. FreeMarker developers only: treat this class as package-visible.
- */
-public class _Log4jOverSLF4JTester {
-
-    private static final String MDC_KEY = _Log4jOverSLF4JTester.class.getName();
-
-    /**
-     * Returns if Log4j-over-SLF4J is actually working. Sometimes the API classes are present, but there's no SLF4J
-     * implementation around.
-     */
-    public static final boolean test() {
-        org.apache.log4j.MDC.put(MDC_KEY, "");
-        try {
-            return org.slf4j.MDC.get(MDC_KEY) != null;
-        } finally {
-            org.apache.log4j.MDC.remove(MDC_KEY);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/_NullLoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/_NullLoggerFactory.java b/src/main/java/freemarker/log/_NullLoggerFactory.java
deleted file mode 100644
index 7e161a5..0000000
--- a/src/main/java/freemarker/log/_NullLoggerFactory.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-/**
- * Don't use this class; it's only public to work around Google App Engine Java
- * compliance issues. FreeMarker developers only: treat this class as package-visible.
- */
-public class _NullLoggerFactory implements LoggerFactory {
-    _NullLoggerFactory() {
-    }
-    
-    public Logger getLogger(String category) {
-        return INSTANCE;
-    }
-
-    private static final Logger INSTANCE = new Logger()
-    {
-        @Override
-        public void debug(String message) {
-        }
-
-        @Override
-        public void debug(String message, Throwable t) {
-        }
-
-        @Override
-        public void error(String message) {
-        }
-
-        @Override
-        public void error(String message, Throwable t) {
-        }
-
-        @Override
-        public void info(String message) {
-        }
-
-        @Override
-        public void info(String message, Throwable t) {
-        }
-
-        @Override
-        public void warn(String message) {
-        }
-
-        @Override
-        public void warn(String message, Throwable t) {
-        }
-
-        @Override
-        public boolean isDebugEnabled() {
-            return false;
-        }
-
-        @Override
-        public boolean isInfoEnabled() {
-            return false;
-        }
-
-        @Override
-        public boolean isWarnEnabled() {
-            return false;
-        }
-
-        @Override
-        public boolean isErrorEnabled() {
-            return false;
-        }
-
-        @Override
-        public boolean isFatalEnabled() {
-            return false;
-        }
-    };
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/_SLF4JLoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/_SLF4JLoggerFactory.java b/src/main/java/freemarker/log/_SLF4JLoggerFactory.java
deleted file mode 100644
index 6332130..0000000
--- a/src/main/java/freemarker/log/_SLF4JLoggerFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package freemarker.log;
-
-
-/**
- * Don't use this class; it's only public to work around Google App Engine Java
- * compliance issues. FreeMarker developers only: treat this class as package-visible.
- */
-public class _SLF4JLoggerFactory extends SLF4JLoggerFactory {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/log/package.html
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/log/package.html b/src/main/java/freemarker/log/package.html
deleted file mode 100644
index afc773c..0000000
--- a/src/main/java/freemarker/log/package.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-  
-    http://www.apache.org/licenses/LICENSE-2.0
-  
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<html>
-<head>
-</head>
-<BODY>
-<p>
-Logging facility; dispatches FreeMarker log messages to the chosen logger library.
-
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/template/Configuration.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/Configuration.java b/src/main/java/freemarker/template/Configuration.java
index 368ce23..f460eac 100644
--- a/src/main/java/freemarker/template/Configuration.java
+++ b/src/main/java/freemarker/template/Configuration.java
@@ -42,6 +42,9 @@ import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import freemarker.cache.CacheStorage;
 import freemarker.cache.ClassTemplateLoader;
 import freemarker.cache.FileTemplateLoader;
@@ -85,7 +88,6 @@ import freemarker.core._SortedArraySet;
 import freemarker.core._UnmodifiableCompositeSet;
 import freemarker.ext.beans.BeansWrapper;
 import freemarker.ext.beans.BeansWrapperBuilder;
-import freemarker.log.Logger;
 import freemarker.template.utility.CaptureOutput;
 import freemarker.template.utility.ClassUtil;
 import freemarker.template.utility.Constants;
@@ -146,7 +148,7 @@ import freemarker.template.utility.XmlEscape;
  */
 public class Configuration extends Configurable implements Cloneable, ParserConfiguration {
     
-    private static final Logger CACHE_LOG = Logger.getLogger("freemarker.cache");
+    private static final Logger LOG = LoggerFactory.getLogger("freemarker.cache");
     
     private static final String VERSION_PROPERTIES_PATH = "freemarker/version.properties";
     
@@ -225,16 +227,19 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * Legacy, snake case ({@code like_this}) variation of the setting name. @since 2.3.23
      * @deprecated Use {@link Configurable#AUTO_IMPORT_KEY_SNAKE_CASE} instead.
      */
+    @Deprecated
     public static final String AUTO_IMPORT_KEY_SNAKE_CASE = "auto_import";
     /**
      * Modern, camel case ({@code likeThis}) variation of the setting name. @since 2.3.23
      * @deprecated Use {@link Configurable#AUTO_IMPORT_KEY_CAMEL_CASE} instead.
      */
+    @Deprecated
     public static final String AUTO_IMPORT_KEY_CAMEL_CASE = "autoImport";
     /**
      * Alias to the {@code ..._SNAKE_CASE} variation due to backward compatibility constraints.
      * @deprecated Use {@link Configurable#AUTO_IMPORT_KEY_SNAKE_CASE} instead.
      */
+    @Deprecated
     public static final String AUTO_IMPORT_KEY = AUTO_IMPORT_KEY_SNAKE_CASE;
     
     /** Legacy, snake case ({@code like_this}) variation of the setting name. @since 2.3.23 */
@@ -895,7 +900,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
             try {
                 return new LegacyDefaultFileTemplateLoader();
             } catch (Exception e) {
-                CACHE_LOG.warn("Couldn't create legacy default TemplateLoader which accesses the current directory. "
+                LOG.warn("Couldn't create legacy default TemplateLoader which accesses the current directory. "
                         + "(Use new Configuration(Configuration.VERSION_2_3_21) or higher to avoid this.)", e);
                 return null;
             }
@@ -904,6 +909,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
         }
     }
     
+    // [FM3] Remove
     private static class LegacyDefaultFileTemplateLoader extends FileTemplateLoader {
 
         public LegacyDefaultFileTemplateLoader() throws IOException {
@@ -1665,6 +1671,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
     /**
      * The getter pair of {@link #setStrictSyntaxMode}.
      */
+    @Override
     public boolean getStrictSyntaxMode() {
         return strictSyntax;
     }
@@ -1734,6 +1741,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * @return Never {@code null}. 
      * @since 2.3.20
      */
+    @Override
     public Version getIncompatibleImprovements() {
         return incompatibleImprovements;
     }
@@ -1777,6 +1785,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      *
      * @see #setWhitespaceStripping
      */
+    @Override
     public boolean getWhitespaceStripping() {
         return whitespaceStripping;
     }
@@ -1841,6 +1850,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * 
      * @since 2.3.24
      */
+    @Override
     public int getAutoEscapingPolicy() {
         return autoEscapingPolicy;
     }
@@ -1886,6 +1896,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * 
      * @since 2.3.24
      */
+    @Override
     public OutputFormat getOutputFormat() {
         return outputFormat;
     }
@@ -2138,6 +2149,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * 
      * @since 2.3.24
      */
+    @Override
     public boolean getRecognizeStandardFileExtensions() {
         return recognizeStandardFileExtensions == null
                 ? incompatibleImprovements.intValue() >= _TemplateAPI.VERSION_INT_2_3_24
@@ -2175,6 +2187,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
     /**
      * The getter pair of {@link #setTagSyntax(int)}.
      */
+    @Override
     public int getTagSyntax() {
         return tagSyntax;
     }
@@ -2240,6 +2253,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * 
      * @since 2.3.23
      */
+    @Override
     public int getNamingConvention() {
         return namingConvention;
     }
@@ -2272,6 +2286,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * 
      * @since 2.3.25
      */
+    @Override
     public int getTabSize() {
         return tabSize;
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/template/utility/CaptureOutput.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/utility/CaptureOutput.java b/src/main/java/freemarker/template/utility/CaptureOutput.java
index d505d0a..fa98871 100644
--- a/src/main/java/freemarker/template/utility/CaptureOutput.java
+++ b/src/main/java/freemarker/template/utility/CaptureOutput.java
@@ -61,6 +61,7 @@ import freemarker.template.TemplateTransformModel;
 @Deprecated
 public class CaptureOutput implements TemplateTransformModel {
 
+    @Override
     public Writer getWriter(final Writer out, final Map args) throws TemplateModelException {
         String errmsg = "Must specify the name of the variable in "
                 + "which to capture the output with the 'var' or 'local' or 'global' parameter.";

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/main/java/freemarker/template/utility/SecurityUtilities.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/utility/SecurityUtilities.java b/src/main/java/freemarker/template/utility/SecurityUtilities.java
index e17289f..95bcf4b 100644
--- a/src/main/java/freemarker/template/utility/SecurityUtilities.java
+++ b/src/main/java/freemarker/template/utility/SecurityUtilities.java
@@ -23,12 +23,13 @@ import java.security.AccessControlException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
-import freemarker.log.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  */
 public class SecurityUtilities {
-    private static final Logger LOG = Logger.getLogger("freemarker.security");
+    private static final Logger LOG = LoggerFactory.getLogger("freemarker.security");
     private SecurityUtilities() {
     }
     
@@ -36,6 +37,7 @@ public class SecurityUtilities {
         return (String) AccessController.doPrivileged(
             new PrivilegedAction()
             {
+                @Override
                 public Object run() {
                     return System.getProperty(key);
                 }
@@ -47,14 +49,17 @@ public class SecurityUtilities {
             return (String) AccessController.doPrivileged(
                 new PrivilegedAction()
                 {
+                    @Override
                     public Object run() {
                         return System.getProperty(key, defValue);
                     }
                 });
         } catch (AccessControlException e) {
-            LOG.warn("Insufficient permissions to read system property " + 
-                    StringUtil.jQuoteNoXSS(key) + ", using default value " +
-                    StringUtil.jQuoteNoXSS(defValue));
+            if (LOG.isWarnEnabled()) {
+                LOG.warn("Insufficient permissions to read system property " + 
+                        StringUtil.jQuoteNoXSS(key) + ", using default value " +
+                        StringUtil.jQuoteNoXSS(defValue));
+            }
             return defValue;
         }
     }
@@ -64,13 +69,16 @@ public class SecurityUtilities {
             return (Integer) AccessController.doPrivileged(
                 new PrivilegedAction()
                 {
+                    @Override
                     public Object run() {
                         return Integer.getInteger(key, defValue);
                     }
                 });
         } catch (AccessControlException e) {
-            LOG.warn("Insufficient permissions to read system property " + 
-                    StringUtil.jQuote(key) + ", using default value " + defValue);
+            if (LOG.isWarnEnabled()) {
+                LOG.warn("Insufficient permissions to read system property " + 
+                        StringUtil.jQuote(key) + ", using default value " + defValue);
+            }
             return Integer.valueOf(defValue);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/manual/en_US/FM3-CHANGE-LOG.txt
----------------------------------------------------------------------
diff --git a/src/manual/en_US/FM3-CHANGE-LOG.txt b/src/manual/en_US/FM3-CHANGE-LOG.txt
index e5c57dd..5c526c4 100644
--- a/src/manual/en_US/FM3-CHANGE-LOG.txt
+++ b/src/manual/en_US/FM3-CHANGE-LOG.txt
@@ -3,4 +3,6 @@ the FreeMarer 3 changelog here:
 
 - Increased version number to 3.0.0 (nightly aka. SNAPSHOT)
 - Removed legacy extensions: rhyno, jython, xml (not to be confused with dom), jdom, ant.
-- Removed JSP 2.0 support (2.1 is the minimum for now, but maybe it will be 2.2 and Servlet 3.0 later).
\ No newline at end of file
+- Removed JSP 2.0 support (2.1 is the minimum for now, but maybe it will be 2.2 and Servlet 3.0 later).
+- Removed freemarker.ext.log, our log abstraction layer from the old times when there was no clear winner on this field.
+  Added org.slf4j:slf4j-api as required dependency instead.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/template/DefaultObjectWrapperTest.java b/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
index 5bb9152..00432ce 100644
--- a/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
+++ b/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
@@ -1029,6 +1029,7 @@ public class DefaultObjectWrapperTest {
     }
 
     private static final class PureIterable implements Iterable<String> {
+        @Override
         public Iterator<String> iterator() {
             return ImmutableList.of("a", "b", "c").iterator();
         }
@@ -1050,6 +1051,7 @@ public class DefaultObjectWrapperTest {
 
         final static NullModel INSTANCE = new NullModel();
 
+        @Override
         public Object getAdaptedObject(Class hint) {
             return null;
         }
@@ -1145,10 +1147,12 @@ public class DefaultObjectWrapperTest {
             this.tupple = tupple;
         }
 
+        @Override
         public int size() throws TemplateModelException {
             return 2;
         }
         
+        @Override
         public TemplateModel get(int index) throws TemplateModelException {
             switch (index) {
             case 0: return wrap(tupple.getE1());
@@ -1157,6 +1161,7 @@ public class DefaultObjectWrapperTest {
             }
         }
 
+        @Override
         public Object getAdaptedObject(Class hint) {
             return tupple;
         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8952cbbb/src/test/java/freemarker/test/servlet/Model2TesterServlet.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/test/servlet/Model2TesterServlet.java b/src/test/java/freemarker/test/servlet/Model2TesterServlet.java
index 8b41be9..e6414a8 100644
--- a/src/test/java/freemarker/test/servlet/Model2TesterServlet.java
+++ b/src/test/java/freemarker/test/servlet/Model2TesterServlet.java
@@ -28,7 +28,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import freemarker.ext.servlet.FreemarkerServlet;
 import freemarker.template.utility.StringUtil;
@@ -44,7 +45,7 @@ import freemarker.template.utility.StringUtil;
  */
 public class Model2TesterServlet extends HttpServlet {
     
-    private static final Logger LOG = Logger.getLogger(Model2TesterServlet.class);
+    private static final Logger LOG = LoggerFactory.getLogger(Model2TesterServlet.class);
     
     public static final String VIEW_PARAM_NAME = "view";
     public static final String ACTION_PARAM_NAME = "action";


Mime
View raw message