Repository: incubator-freemarker Updated Branches: refs/heads/3 72e52eef0 -> e6bead938
Log categories are now simply the full qualified class name of the logging classes. There are no predefined log categories (such as "freemarker.runtime", etc.) anymore. This is to follow the common practices in logging. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/e6bead93 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/e6bead93 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/e6bead93 Branch: refs/heads/3 Commit: e6bead93868cfa3cc36acb77279be2c755e372b0 Parents: 72e52ee Author: ddekany <ddek...@apache.org> Authored: Tue Jul 4 17:02:45 2017 +0200 Committer: ddekany <ddek...@apache.org> Committed: Tue Jul 4 17:02:45 2017 +0200 ---------------------------------------------------------------------- FM3-CHANGE-LOG.txt | 8 ++-- .../org/apache/freemarker/core/Environment.java | 13 +++--- .../core/LoggingAttemptExceptionReporter.java | 10 ++++- .../apache/freemarker/core/RegexpHelper.java | 3 +- .../org/apache/freemarker/core/_CoreLogs.java | 46 -------------------- .../core/_ErrorDescriptionBuilder.java | 3 +- .../freemarker/core/debug/DebuggerServer.java | 4 +- .../core/debug/RmiDebuggerListenerImpl.java | 9 ++-- .../freemarker/core/model/impl/BeanModel.java | 8 ++-- .../core/model/impl/ClassIntrospector.java | 4 +- .../freemarker/core/model/impl/StaticModel.java | 6 +-- .../core/model/impl/UnsafeMethods.java | 6 +-- .../impl/DefaultTemplateResolver.java | 7 +-- .../impl/FileTemplateLoader.java | 4 +- .../impl/URLTemplateLoader.java | 8 ++-- .../freemarker/core/util/_JavaVersions.java | 9 ++-- .../freemarker/core/util/_SecurityUtil.java | 6 +-- .../impl/JavaTemplateDateFormatFactory.java | 6 +-- .../impl/JavaTemplateNumberFormatFactory.java | 6 +-- .../freemarker/servlet/FreemarkerServlet.java | 11 +---- .../freemarker/servlet/InitParamParser.java | 5 ++- .../servlet/WebAppTemplateLoader.java | 3 +- .../apache/freemarker/servlet/_ServletLogs.java | 34 --------------- .../freemarker/servlet/jsp/EventForwarding.java | 4 +- .../jsp/FreeMarkerJspApplicationContext.java | 4 +- .../servlet/jsp/TagTransformModel.java | 4 +- .../freemarker/servlet/jsp/TaglibFactory.java | 4 +- .../servlet/jsp/_FreeMarkerPageContext21.java | 6 +-- .../apache/freemarker/spring/_SpringLogs.java | 35 --------------- .../SpringResourceTemplateLoader.java | 4 +- 30 files changed, 85 insertions(+), 195 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/FM3-CHANGE-LOG.txt ---------------------------------------------------------------------- diff --git a/FM3-CHANGE-LOG.txt b/FM3-CHANGE-LOG.txt index 617cb5e..6bea140 100644 --- a/FM3-CHANGE-LOG.txt +++ b/FM3-CHANGE-LOG.txt @@ -25,6 +25,8 @@ the FreeMarer 3 changelog here: - Removed JSP 2.0 support (2.1 and Servlet 2.5 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. +- Log categories are now simply the full qualified class name of the logging classes. There are no predefined log + categories (such as "freemarker.runtime", etc.) anymore. This is to follow the common practices in logging. - Removed all classes with "main" methods that were part of freemarker.jar. Such tools should be separate artifacts, not part of the library, and they are often classified as CWE-489 "Leftover Debug Code". The removed classes are: freemarker.core.CommandLine, freemarker.ext.dom.Transform, freemarker.template.utility.ToCanonical @@ -290,8 +292,8 @@ the FreeMarer 3 changelog here: - Removed long deprecated `#{}` interpolations. They are treated as plain static text now. (The template converter tool translates these to `${}` interpolations. For example `#{x}` is simply translated to `${b}`, while `#{x; m1M3}` is translated to `${x?string('0.0##')}`). -- #attempt now logs errors into the org.apache.freemarker.core.Runtime.Attempt log chategory (by - default). It doesn't create an additional debug level log entry anymore. +- #attempt doesn't create an additional debug level log entry when an exception is catched. It only + log an error level log (by default at least; see the `attemptExceptionReporter` setting) - You can't close #attempt/#recover with `</#recover>` anymore, only with `<#attempt>`. This was the standard form in FM2 as well, and is consistent with how #if/#else works. (The template converter - tool does this conversion.) \ No newline at end of file + tool does this conversion.) http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java index c825dc3..fd9e35c 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java @@ -80,6 +80,7 @@ import org.apache.freemarker.core.valueformat.impl.JavaTemplateDateFormatFactory import org.apache.freemarker.core.valueformat.impl.JavaTemplateNumberFormatFactory; import org.apache.freemarker.core.valueformat.impl.XSTemplateDateFormatFactory; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -100,18 +101,16 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; * because unset settings are ultimately inherited from {@link Configuration}. */ public final class Environment extends MutableProcessingConfiguration<Environment> implements CustomStateScope { - - private static final ThreadLocal<Environment> TLS_ENVIRONMENT = new ThreadLocal(); - private static final Logger LOG = _CoreLogs.RUNTIME; + private static final Logger LOG = LoggerFactory.getLogger(Environment.class); + + private static final ThreadLocal<Environment> TLS_ENVIRONMENT = new ThreadLocal(); // Do not use this object directly; deepClone it first! DecimalFormat isn't // thread-safe. - private static final DecimalFormat C_NUMBER_FORMAT = new DecimalFormat( - "0.################", - new DecimalFormatSymbols(Locale.US)); - + private static final DecimalFormat C_NUMBER_FORMAT; static { + C_NUMBER_FORMAT = new DecimalFormat("0.################", new DecimalFormatSymbols(Locale.US)); C_NUMBER_FORMAT.setGroupingUsed(false); C_NUMBER_FORMAT.setDecimalSeparatorAlwaysShown(false); } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/LoggingAttemptExceptionReporter.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/LoggingAttemptExceptionReporter.java b/freemarker-core/src/main/java/org/apache/freemarker/core/LoggingAttemptExceptionReporter.java index 6f120f0..30c787a 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/LoggingAttemptExceptionReporter.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/LoggingAttemptExceptionReporter.java @@ -19,12 +19,18 @@ package org.apache.freemarker.core; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * Default {@link AttemptExceptionReporter} implementation, factored out from {@link AttemptExceptionReporter} so that * we can have static field. */ class LoggingAttemptExceptionReporter implements AttemptExceptionReporter { + + private static final Logger LOG = LoggerFactory.getLogger(LoggingAttemptExceptionReporter.class); + private final boolean logAsWarn; public LoggingAttemptExceptionReporter(boolean logAsWarn) { @@ -34,9 +40,9 @@ class LoggingAttemptExceptionReporter implements AttemptExceptionReporter { public void report(TemplateException te, Environment env) { String message = "Error executing FreeMarker template part in the #attempt block"; if (!logAsWarn) { - _CoreLogs.ATTEMPT.error(message, te); + LOG.error(message, te); } else { - _CoreLogs.ATTEMPT.warn(message, te); + LOG.warn(message, te); } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/RegexpHelper.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/RegexpHelper.java b/freemarker-core/src/main/java/org/apache/freemarker/core/RegexpHelper.java index 3d0e853..d564d31 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/RegexpHelper.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/RegexpHelper.java @@ -26,13 +26,14 @@ import org.apache.freemarker.core.model.TemplateModelException; import org.apache.freemarker.core.templateresolver.impl.MruCacheStorage; import org.apache.freemarker.core.util._StringUtil; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Helper for language features (like built-ins) that use regular expressions. */ final class RegexpHelper { - private static final Logger LOG = _CoreLogs.RUNTIME; + private static final Logger LOG = LoggerFactory.getLogger(RegexpHelper.class); private static volatile boolean flagWarningsEnabled = LOG.isWarnEnabled(); private static final int MAX_FLAG_WARNINGS_LOGGED = 25; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/_CoreLogs.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/_CoreLogs.java b/freemarker-core/src/main/java/org/apache/freemarker/core/_CoreLogs.java deleted file mode 100644 index 9179d7c..0000000 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/_CoreLogs.java +++ /dev/null @@ -1,46 +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 org.apache.freemarker.core; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * For internal use only; don't depend on this, there's no backward compatibility guarantee at all! - * This class is to work around the lack of module system in Java, i.e., so that other FreeMarker packages can - * access things inside this package that users shouldn't. - */ -public final class _CoreLogs { - - // [FM3] Why "Runtime"? "TemplateProcessing" maybe? - public static final Logger RUNTIME = LoggerFactory.getLogger("org.apache.freemarker.core.Runtime"); - public static final Logger ATTEMPT = LoggerFactory.getLogger("org.apache.freemarker.core.Runtime.Attempt"); - public static final Logger SECURITY = LoggerFactory.getLogger("org.apache.freemarker.core.Security"); - public static final Logger OBJECT_WRAPPER = LoggerFactory.getLogger("org.apache.freemarker.core.model" + - ".ObjectWrapper"); - public static final Logger TEMPLATE_RESOLVER = LoggerFactory.getLogger( - "org.apache.freemarker.core.templateresolver"); - public static final Logger DEBUG_SERVER = LoggerFactory.getLogger("org.apache.freemarker.core.debug.server"); - public static final Logger DEBUG_CLIENT = LoggerFactory.getLogger("org.apache.freemarker.core.debug.client"); - - private _CoreLogs() { - // Not meant to be instantiated - } - -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/_ErrorDescriptionBuilder.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/_ErrorDescriptionBuilder.java b/freemarker-core/src/main/java/org/apache/freemarker/core/_ErrorDescriptionBuilder.java index 4723f58..c548487 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/_ErrorDescriptionBuilder.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/_ErrorDescriptionBuilder.java @@ -27,6 +27,7 @@ import org.apache.freemarker.core.model.impl._MethodUtil; import org.apache.freemarker.core.util._ClassUtil; import org.apache.freemarker.core.util._StringUtil; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Used internally only, might changes without notice! @@ -36,7 +37,7 @@ import org.slf4j.Logger; */ public class _ErrorDescriptionBuilder { - private static final Logger LOG = _CoreLogs.RUNTIME; + private static final Logger LOG = LoggerFactory.getLogger(_ErrorDescriptionBuilder.class); private final String description; private final Object[] descriptionParts; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebuggerServer.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebuggerServer.java b/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebuggerServer.java index 29fa199..c1428c1 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebuggerServer.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebuggerServer.java @@ -32,16 +32,16 @@ import java.security.SecureRandom; import java.util.Arrays; import java.util.Random; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.util.UndeclaredThrowableException; import org.apache.freemarker.core.util._SecurityUtil; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** */ class DebuggerServer { - private static final Logger LOG = _CoreLogs.DEBUG_SERVER; + private static final Logger LOG = LoggerFactory.getLogger(DebuggerServer.class); // TODO: Eventually replace with Yarrow // TODO: Can be extremely slow (on Linux, not enough entropy) http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/debug/RmiDebuggerListenerImpl.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/debug/RmiDebuggerListenerImpl.java b/freemarker-core/src/main/java/org/apache/freemarker/core/debug/RmiDebuggerListenerImpl.java index 28985ec..0826f54 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/debug/RmiDebuggerListenerImpl.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/debug/RmiDebuggerListenerImpl.java @@ -24,11 +24,8 @@ import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.rmi.server.Unreferenced; -import org.apache.freemarker.core._CoreLogs; -import org.apache.freemarker.core.debug.DebuggerClient; -import org.apache.freemarker.core.debug.DebuggerListener; -import org.apache.freemarker.core.debug.EnvironmentSuspendedEvent; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Used by the {@link DebuggerClient} to invoke local @@ -38,8 +35,8 @@ extends UnicastRemoteObject implements DebuggerListener, Unreferenced { - - private static final Logger LOG = _CoreLogs.DEBUG_CLIENT; + + private static final Logger LOG = LoggerFactory.getLogger(RmiDebuggerListenerImpl.class); private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/BeanModel.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/BeanModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/BeanModel.java index 1f51892..aa2f2f1 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/BeanModel.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/BeanModel.java @@ -32,7 +32,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core._DelayedFTLTypeDescription; import org.apache.freemarker.core._DelayedJQuote; import org.apache.freemarker.core._TemplateModelException; @@ -47,6 +46,7 @@ import org.apache.freemarker.core.model.TemplateScalarModel; import org.apache.freemarker.core.model.WrapperTemplateModel; import org.apache.freemarker.core.util._StringUtil; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A class that will wrap an arbitrary object into {@link org.apache.freemarker.core.model.TemplateHashModel} @@ -60,9 +60,9 @@ import org.slf4j.Logger; public class BeanModel implements TemplateHashModelEx, AdapterTemplateModel, WrapperTemplateModel, TemplateModelWithAPISupport { - - private static final Logger LOG = _CoreLogs.OBJECT_WRAPPER; - + + private static final Logger LOG = LoggerFactory.getLogger(BeanModel.class); + protected final Object object; protected final DefaultObjectWrapper wrapper; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java index 0b9129e..ead6c7a 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java @@ -48,12 +48,12 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.apache.freemarker.core.Version; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.util.BugException; import org.apache.freemarker.core.util.CommonBuilder; import org.apache.freemarker.core.util._JavaVersions; import org.apache.freemarker.core.util._NullArgumentException; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Returns information about a {@link Class} that's useful for FreeMarker. Encapsulates a cache for this. Thread-safe, @@ -70,7 +70,7 @@ class ClassIntrospector { // these are shared by many object wrappers, and concurrency related glitches due to user errors must remain // local to the object wrappers, not corrupting the shared ClassIntrospector. - private static final Logger LOG = _CoreLogs.OBJECT_WRAPPER; + private static final Logger LOG = LoggerFactory.getLogger(ClassIntrospector.class); private static final String JREBEL_SDK_CLASS_NAME = "org.zeroturnaround.javarebel.ClassEventListener"; private static final String JREBEL_INTEGRATION_ERROR_MSG http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java index fbee788..8a7f082 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java @@ -26,12 +26,12 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.model.TemplateCollectionModel; import org.apache.freemarker.core.model.TemplateHashModelEx; import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.model.TemplateModelException; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Wraps the static fields and methods of a class in a @@ -43,8 +43,8 @@ import org.slf4j.Logger; */ final class StaticModel implements TemplateHashModelEx { - private static final Logger LOG = _CoreLogs.OBJECT_WRAPPER; - + private static final Logger LOG = LoggerFactory.getLogger(StaticModel.class); + private final Class clazz; private final DefaultObjectWrapper wrapper; private final Map map = new HashMap(); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/UnsafeMethods.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/UnsafeMethods.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/UnsafeMethods.java index e3270c3..1b6d246 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/UnsafeMethods.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/UnsafeMethods.java @@ -29,13 +29,13 @@ import java.util.Properties; import java.util.Set; import java.util.StringTokenizer; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.util._ClassUtil; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; class UnsafeMethods { - - private static final Logger LOG = _CoreLogs.OBJECT_WRAPPER; + + private static final Logger LOG = LoggerFactory.getLogger(UnsafeMethods.class); private static final String UNSAFE_METHODS_PROPERTIES = "unsafeMethods.properties"; private static final Set UNSAFE_METHODS = createUnsafeMethodsSet(); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java index 3a7f406..2504ccc 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/DefaultTemplateResolver.java @@ -42,7 +42,6 @@ import org.apache.freemarker.core.TemplateConfiguration; import org.apache.freemarker.core.TemplateLanguage; import org.apache.freemarker.core.TemplateNotFoundException; import org.apache.freemarker.core.WrongTemplateCharsetException; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.templateresolver.CacheStorage; import org.apache.freemarker.core.templateresolver.GetTemplateResult; import org.apache.freemarker.core.templateresolver.MalformedTemplateNameException; @@ -62,6 +61,7 @@ import org.apache.freemarker.core.util.UndeclaredThrowableException; import org.apache.freemarker.core.util._NullArgumentException; import org.apache.freemarker.core.util._StringUtil; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The default implementation of the {@link TemplateResolver} class; the default value of @@ -73,12 +73,13 @@ public class DefaultTemplateResolver extends TemplateResolver { * The default template update delay; see {@link Configuration#getTemplateUpdateDelayMilliseconds()}. */ public static final long DEFAULT_TEMPLATE_UPDATE_DELAY_MILLIS = 5000L; - + + private static final Logger LOG = LoggerFactory.getLogger(DefaultTemplateResolver.class); + private static final String ASTERISKSTR = "*"; private static final char ASTERISK = '*'; private static final char SLASH = '/'; private static final String LOCALE_PART_SEPARATOR = "_"; - private static final Logger LOG = _CoreLogs.TEMPLATE_RESOLVER; /** Maybe {@code null}. */ private TemplateLoader templateLoader; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java index 4c9012d..4976746 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java @@ -32,7 +32,6 @@ import java.security.PrivilegedExceptionAction; import java.util.Objects; import org.apache.freemarker.core.Configuration; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.templateresolver.TemplateLoader; import org.apache.freemarker.core.templateresolver.TemplateLoaderSession; import org.apache.freemarker.core.templateresolver.TemplateLoadingResult; @@ -40,6 +39,7 @@ import org.apache.freemarker.core.templateresolver.TemplateLoadingSource; import org.apache.freemarker.core.util._SecurityUtil; import org.apache.freemarker.core.util._StringUtil; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A {@link TemplateLoader} that uses files inside a specified directory as the source of templates. By default it does @@ -73,7 +73,7 @@ public class FileTemplateLoader implements TemplateLoader { private static final int CASE_CHECK_CACHE__SOFT_SIZE = 1000; private static final boolean SEP_IS_SLASH = File.separatorChar == '/'; - private static final Logger LOG = _CoreLogs.TEMPLATE_RESOLVER; + private static final Logger LOG = LoggerFactory.getLogger(FileTemplateLoader.class); public final File baseDir; private final String canonicalBasePath; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java index 0bbebf7..16137e7 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/URLTemplateLoader.java @@ -29,23 +29,23 @@ import java.net.URLConnection; import java.util.Objects; import org.apache.freemarker.core.Configuration; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.templateresolver.TemplateLoader; import org.apache.freemarker.core.templateresolver.TemplateLoaderSession; import org.apache.freemarker.core.templateresolver.TemplateLoadingResult; import org.apache.freemarker.core.templateresolver.TemplateLoadingSource; import org.apache.freemarker.core.templateresolver.TemplateLookupStrategy; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This is an abstract template loader that can load templates whose location can be described by an URL. Subclasses * only need to override the {@link #getURL(String)}, {@link #extractNegativeResult(URLConnection)}, and perhaps the * {@link #prepareConnection(URLConnection)} method. */ -// TODO JUnit test (including implementing a HTTP-based template loader to test the new protected methods) +// TODO [FM3] JUnit test (including implementing a HTTP-based template loader to test the new protected methods) public abstract class URLTemplateLoader implements TemplateLoader { - - private static final Logger LOG = _CoreLogs.TEMPLATE_RESOLVER; + + private static final Logger LOG = LoggerFactory.getLogger(URLTemplateLoader.class); private Boolean urlConnectionUsesCaches = false; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/util/_JavaVersions.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_JavaVersions.java b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_JavaVersions.java index 10f79fe..96a9583 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_JavaVersions.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_JavaVersions.java @@ -19,14 +19,17 @@ package org.apache.freemarker.core.util; import org.apache.freemarker.core.Version; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core._Java8; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Used internally only, might changes without notice! */ public final class _JavaVersions { - + + private static final Logger LOG = LoggerFactory.getLogger(_JavaVersions.class); + private _JavaVersions() { // Not meant to be instantiated } @@ -65,7 +68,7 @@ public final class _JavaVersions { .getField("INSTANCE").get(null); } catch (Exception e) { try { - _CoreLogs.RUNTIME.error("Failed to access Java 8 functionality", e); + LOG.error("Failed to access Java 8 functionality", e); } catch (Exception e2) { // Suppressed } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SecurityUtil.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SecurityUtil.java b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SecurityUtil.java index 60125a5..eebed61 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SecurityUtil.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SecurityUtil.java @@ -23,14 +23,14 @@ import java.security.AccessControlException; import java.security.AccessController; import java.security.PrivilegedAction; -import org.apache.freemarker.core._CoreLogs; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** */ public class _SecurityUtil { - - private static final Logger LOG = _CoreLogs.SECURITY; + + private static final Logger LOG = LoggerFactory.getLogger(_SecurityUtil.class); private _SecurityUtil() { } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateDateFormatFactory.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateDateFormatFactory.java b/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateDateFormatFactory.java index 093e110..9c94e82 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateDateFormatFactory.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateDateFormatFactory.java @@ -27,13 +27,13 @@ import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import org.apache.freemarker.core.Environment; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.model.TemplateDateModel; import org.apache.freemarker.core.valueformat.InvalidFormatParametersException; import org.apache.freemarker.core.valueformat.TemplateDateFormat; import org.apache.freemarker.core.valueformat.TemplateDateFormatFactory; import org.apache.freemarker.core.valueformat.UnknownDateTypeFormattingUnsupportedException; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Deals with {@link TemplateDateFormat}-s that wrap a Java {@link DateFormat}. The parameter string is usually a @@ -47,8 +47,8 @@ import org.slf4j.Logger; public class JavaTemplateDateFormatFactory extends TemplateDateFormatFactory { public static final JavaTemplateDateFormatFactory INSTANCE = new JavaTemplateDateFormatFactory(); - - private static final Logger LOG = _CoreLogs.RUNTIME; + + private static final Logger LOG = LoggerFactory.getLogger(JavaTemplateDateFormatFactory.class); private static final ConcurrentHashMap<CacheKey, DateFormat> GLOBAL_FORMAT_CACHE = new ConcurrentHashMap<>(); private static final int LEAK_ALERT_DATE_FORMAT_CACHE_SIZE = 1024; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateNumberFormatFactory.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateNumberFormatFactory.java b/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateNumberFormatFactory.java index cf292df..6148569 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateNumberFormatFactory.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/valueformat/impl/JavaTemplateNumberFormatFactory.java @@ -24,11 +24,11 @@ import java.util.Locale; import java.util.concurrent.ConcurrentHashMap; import org.apache.freemarker.core.Environment; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.valueformat.InvalidFormatParametersException; import org.apache.freemarker.core.valueformat.TemplateNumberFormat; import org.apache.freemarker.core.valueformat.TemplateNumberFormatFactory; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Deals with {@link TemplateNumberFormat}-s that wrap a Java {@link NumberFormat}. The parameter string is usually @@ -44,8 +44,8 @@ import org.slf4j.Logger; public class JavaTemplateNumberFormatFactory extends TemplateNumberFormatFactory { public static final JavaTemplateNumberFormatFactory INSTANCE = new JavaTemplateNumberFormatFactory(); - - private static final Logger LOG = _CoreLogs.RUNTIME; + + private static final Logger LOG = LoggerFactory.getLogger(JavaTemplateNumberFormatFactory.class); private static final ConcurrentHashMap<CacheKey, NumberFormat> GLOBAL_FORMAT_CACHE = new ConcurrentHashMap<>(); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java index 923f9d4..9b5008f 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java @@ -50,7 +50,6 @@ import org.apache.freemarker.core.Template; import org.apache.freemarker.core.TemplateException; import org.apache.freemarker.core.TemplateExceptionHandler; import org.apache.freemarker.core.TemplateNotFoundException; -import org.apache.freemarker.core._CoreLogs; import org.apache.freemarker.core.model.ObjectWrapper; import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper; import org.apache.freemarker.core.model.TemplateModel; @@ -68,6 +67,7 @@ import org.apache.freemarker.servlet.jsp.TaglibFactory; import org.apache.freemarker.servlet.jsp.TaglibFactory.MetaInfTldSource; import org.apache.freemarker.servlet.jsp.TaglibFactoryBuilder; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -325,10 +325,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; // [FM3] Lot of things are marked here with "BC" and deprecated public class FreemarkerServlet extends HttpServlet { - private static final Logger LOG = _ServletLogs.ROOT; - - @Deprecated - private static final Logger LOG_RT = _CoreLogs.RUNTIME; + private static final Logger LOG = LoggerFactory.getLogger(FreemarkerServlet.class); public static final long serialVersionUID = -2440216393145762479L; @@ -885,10 +882,6 @@ public class FreemarkerServlet extends HttpServlet { private ServletException newServletExceptionWithFreeMarkerLogging(String message, Throwable cause) throws ServletException { if (cause instanceof TemplateException) { - // For backward compatibility, we log into the same category as Environment did when - // log_template_exceptions was true. - LOG_RT.error(message, cause); - } else { LOG.error(message, cause); } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java index e6bdd0a..747dc50 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/InitParamParser.java @@ -35,6 +35,7 @@ import org.apache.freemarker.core.templateresolver.impl.FileTemplateLoader; import org.apache.freemarker.core.templateresolver.impl.MultiTemplateLoader; import org.apache.freemarker.core.util._StringUtil; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; final class InitParamParser { @@ -45,8 +46,8 @@ final class InitParamParser { static final String TEMPLATE_PATH_PREFIX_CLASSPATH = "classpath:"; static final String TEMPLATE_PATH_PREFIX_FILE = "file://"; static final String TEMPLATE_PATH_SETTINGS_BI_NAME = "settings"; - - private static final Logger LOG = _ServletLogs.ROOT; + + private static final Logger LOG = LoggerFactory.getLogger(InitParamParser.class); private InitParamParser() { // Not to be instantiated http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java index 8213d3d..adbc5e0 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/WebAppTemplateLoader.java @@ -42,6 +42,7 @@ import org.apache.freemarker.core.util._CollectionUtil; import org.apache.freemarker.core.util._NullArgumentException; import org.apache.freemarker.core.util._StringUtil; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A {@link TemplateLoader} that uses streams reachable through {@link ServletContext#getResource(String)} as its source @@ -49,7 +50,7 @@ import org.slf4j.Logger; */ public class WebAppTemplateLoader implements TemplateLoader { - private static final Logger LOG = _ServletLogs.ROOT; + private static final Logger LOG = LoggerFactory.getLogger(WebAppTemplateLoader.class); private final ServletContext servletContext; private final String subdirPath; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/_ServletLogs.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/_ServletLogs.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/_ServletLogs.java deleted file mode 100644 index 786a78e..0000000 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/_ServletLogs.java +++ /dev/null @@ -1,34 +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 org.apache.freemarker.servlet; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * For internal use only; don't depend on this, there's no backward compatibility guarantee at all! - * This class is to work around the lack of module system in Java, i.e., so that other FreeMarker packages can - * access things inside this package that users shouldn't. - */ -public final class _ServletLogs { - - public static final Logger ROOT = LoggerFactory.getLogger("org.apache.freemarker.servlet"); - public static final Logger JSP = LoggerFactory.getLogger("org.apache.freemarker.servlet.jsp"); - -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/EventForwarding.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/EventForwarding.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/EventForwarding.java index 2fcf5c1..c3c4885 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/EventForwarding.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/EventForwarding.java @@ -34,8 +34,8 @@ import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; -import org.apache.freemarker.servlet._ServletLogs; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * An instance of this class should be registered as a <tt><listener></tt> in @@ -48,7 +48,7 @@ public class EventForwarding ServletContextListener, HttpSessionListener, HttpSessionAttributeListener { - private static final Logger LOG = _ServletLogs.JSP; + private static final Logger LOG = LoggerFactory.getLogger(EventForwarding.class); private static final String ATTR_NAME = EventForwarding.class.getName(); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java index c023ab0..12f0d3c 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/FreeMarkerJspApplicationContext.java @@ -41,13 +41,13 @@ import javax.servlet.jsp.el.ImplicitObjectELResolver; import javax.servlet.jsp.el.ScopedAttributeELResolver; import org.apache.freemarker.core.util._ClassUtil; -import org.apache.freemarker.servlet._ServletLogs; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** */ class FreeMarkerJspApplicationContext implements JspApplicationContext { - private static final Logger LOG = _ServletLogs.JSP; + private static final Logger LOG = LoggerFactory.getLogger(FreeMarkerJspApplicationContext.class); private static final ExpressionFactory expressionFactoryImpl = findExpressionFactoryImplementation(); private final LinkedList listeners = new LinkedList(); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TagTransformModel.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TagTransformModel.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TagTransformModel.java index 1bd77fe..ce7b040 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TagTransformModel.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TagTransformModel.java @@ -39,15 +39,15 @@ import javax.servlet.jsp.tagext.TryCatchFinally; import org.apache.freemarker.core.model.TemplateModelException; import org.apache.freemarker.core.model.TemplateTransformModel; import org.apache.freemarker.core.model.TransformControl; -import org.apache.freemarker.servlet._ServletLogs; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Adapts a {@link Tag}-based custom JSP tag to be a value that's callable in templates as an user-defined directive. * For {@link SimpleTag}-based custom JSP tags {@link SimpleTagDirectiveModel} is used instead. */ class TagTransformModel extends JspTagModelBase implements TemplateTransformModel { - private static final Logger LOG = _ServletLogs.JSP; + private static final Logger LOG = LoggerFactory.getLogger(TagTransformModel.class); private final boolean isBodyTag; private final boolean isIterationTag; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java index 9d87357..0fbba1b 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java @@ -75,8 +75,8 @@ import org.apache.freemarker.core.util._NullArgumentException; import org.apache.freemarker.core.util._StringUtil; import org.apache.freemarker.servlet.FreemarkerServlet; import org.apache.freemarker.servlet.HttpRequestHashModel; -import org.apache.freemarker.servlet._ServletLogs; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.xml.sax.Attributes; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; @@ -107,7 +107,7 @@ public class TaglibFactory implements TemplateHashModel { public static final List/*<? extends MetaInfTldSource>*/ DEFAULT_META_INF_TLD_SOURCES = Collections.singletonList(WebInfPerLibJarMetaInfTldSource.INSTANCE); - private static final Logger LOG = _ServletLogs.JSP; + private static final Logger LOG = LoggerFactory.getLogger(TaglibFactory.class); private static final int URL_TYPE_FULL = 0; private static final int URL_TYPE_ABSOLUTE = 1; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java index a146c01..2500665 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/_FreeMarkerPageContext21.java @@ -33,8 +33,8 @@ import javax.servlet.jsp.el.VariableResolver; import org.apache.freemarker.core.model.TemplateModelException; import org.apache.freemarker.core.util._ClassUtil; -import org.apache.freemarker.servlet._ServletLogs; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Don't use this class; it's only public to work around Google App Engine Java @@ -43,8 +43,8 @@ import org.slf4j.Logger; * Implementation of PageContext that contains all JSP 2.1 methods. */ public class _FreeMarkerPageContext21 extends FreeMarkerPageContext { - - private static final Logger LOG = _ServletLogs.JSP; + + private static final Logger LOG = LoggerFactory.getLogger(_FreeMarkerPageContext21.class); static { if (JspFactory.getDefaultFactory() == null) { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-spring/src/main/java/org/apache/freemarker/spring/_SpringLogs.java ---------------------------------------------------------------------- diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/_SpringLogs.java b/freemarker-spring/src/main/java/org/apache/freemarker/spring/_SpringLogs.java deleted file mode 100644 index 87d0a63..0000000 --- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/_SpringLogs.java +++ /dev/null @@ -1,35 +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 org.apache.freemarker.spring; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * For internal use only; don't depend on this, there's no backward compatibility guarantee at all! - * This class is to work around the lack of module system in Java, i.e., so that other FreeMarker packages can - * access things inside this package that users shouldn't. - */ -public final class _SpringLogs { - - public static final Logger CORE = LoggerFactory.getLogger("org.apache.freemarker.spring"); - - public static final Logger TEMPLATE_RESOLVER = LoggerFactory.getLogger("org.apache.freemarker.spring.templateresolver"); - -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e6bead93/freemarker-spring/src/main/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoader.java ---------------------------------------------------------------------- diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoader.java b/freemarker-spring/src/main/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoader.java index 3230841..e91fd68 100644 --- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoader.java +++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoader.java @@ -26,8 +26,8 @@ import org.apache.freemarker.core.templateresolver.TemplateLoader; import org.apache.freemarker.core.templateresolver.TemplateLoaderSession; import org.apache.freemarker.core.templateresolver.TemplateLoadingResult; import org.apache.freemarker.core.templateresolver.TemplateLoadingSource; -import org.apache.freemarker.spring._SpringLogs; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.ResourceLoaderAware; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; @@ -37,7 +37,7 @@ import org.springframework.core.io.ResourceLoader; */ public class SpringResourceTemplateLoader implements TemplateLoader, ResourceLoaderAware { - private static final Logger LOG = _SpringLogs.TEMPLATE_RESOLVER; + private static final Logger LOG = LoggerFactory.getLogger(SpringResourceTemplateLoader.class); /** * Base template resource location.