From e69b605cc8ac0db885e83aec424eddc58aa577f9 Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Mon, 11 Nov 2024 15:14:45 -0800 Subject: [PATCH 1/2] remove slf4j --- LICENSE | 31 ------------------- build.gradle | 3 +- .../gsp/io/DefaultGroovyPageLocator.java | 29 ++++++++--------- .../web/GroovyPagesGrailsPlugin.groovy | 4 +-- .../plugins/web/taglib/FormTagLib.groovy | 6 ++-- .../artefact/gsp/TagLibArtefactHandler.java | 10 +++--- .../taglib/encoder/WithCodecHelper.groovy | 2 -- .../servlet/view/GroovyPageViewResolver.java | 14 ++++----- 8 files changed, 34 insertions(+), 65 deletions(-) diff --git a/LICENSE b/LICENSE index c081d820ee..7bf4ea8fdb 100644 --- a/LICENSE +++ b/LICENSE @@ -224,7 +224,6 @@ SECTION 1: BSD-STYLE, MIT-STYLE, OR SIMILAR STYLE LICENSES >>> dom4j-1.6.1 >>> hsqldb-1.8.0.10 >>> jline-2.11 - >>> slf4j-1.7.5 @@ -392,36 +391,6 @@ Copyright (c) 2002-2007, Marc Prud'hommeaux. All rights reserved. This software is distributable under the BSD license. See the terms of the BSD license in the documentation provided with this software. ->>> slf4j-1.7.5 - -Copyright (c) 2004-2007 QOS.ch -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------- SECTION 2: Apache License, V2.0 ---------- - -Apache License, V2.0 is applicable to the following component(s). - - >>> ant-1.9.4 Apache License diff --git a/build.gradle b/build.gradle index e7b953d957..1caabceb03 100644 --- a/build.gradle +++ b/build.gradle @@ -72,10 +72,9 @@ subprojects { subproject -> } dependencies { - api platform("org.grails:grails-bom:$grailsVersion") + implementation platform("org.grails:grails-bom:$grailsVersion") api "org.apache.groovy:groovy:$groovyVersion" - api "org.slf4j:slf4j-api" testImplementation "org.spockframework:spock-core" testImplementation "org.springframework:spring-test" diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/io/DefaultGroovyPageLocator.java b/grails-gsp/src/main/groovy/org/grails/gsp/io/DefaultGroovyPageLocator.java index 9b0a50fa11..7f4b6cf173 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/io/DefaultGroovyPageLocator.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/io/DefaultGroovyPageLocator.java @@ -25,8 +25,6 @@ import org.grails.io.support.GrailsResourceUtils; import org.grails.plugins.BinaryGrailsPlugin; import org.grails.taglib.TemplateVariableBinding; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -42,6 +40,8 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArraySet; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Used to locate GSPs whether in development or WAR deployed mode from static @@ -52,7 +52,8 @@ */ public class DefaultGroovyPageLocator implements GroovyPageLocator, ResourceLoaderAware, ApplicationContextAware, PluginManagerAware { - private static final Logger LOG = LoggerFactory.getLogger(DefaultGroovyPageLocator.class); + private static final Logger LOG = Logger.getLogger(DefaultGroovyPageLocator.class.getName()); + public static final String PATH_TO_WEB_INF_VIEWS = "/WEB-INF/grails-app/views"; private static final String SLASHED_VIEWS_DIR_PATH = "/" + GrailsResourceUtils.VIEWS_DIR_PATH; private static final String PLUGINS_PATH = "/plugins/"; @@ -229,13 +230,13 @@ protected GroovyPageScriptSource findBinaryScriptSource(String uri) { } BinaryGrailsPlugin binaryPlugin = (BinaryGrailsPlugin) plugin; - if(LOG.isDebugEnabled()) { - LOG.debug("Searching plugin [{}] for GSP view [{}]", plugin.getName(), uri); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("Searching plugin [%s] for GSP view [%s]", plugin.getName(), uri)); } GroovyPageScriptSource scriptSource = resolveViewInBinaryPlugin(binaryPlugin, uri); if (scriptSource != null) { - if(LOG.isDebugEnabled()) { - LOG.debug("Found GSP view [{}] in plugin [{}]", uri, plugin.getName()); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("Found GSP view [%s] in plugin [%s]", uri, plugin.getName())); } return scriptSource; } @@ -354,22 +355,22 @@ protected GroovyPageScriptSource findResourceScriptPathForSearchPaths(String uri for (String searchPath : searchPaths) { String gspClassName = precompiledGspMap.get(searchPath); if (gspClassName != null && !reloadedPrecompiledGspClassNames.contains(gspClassName)) { - if(LOG.isDebugEnabled()) { - LOG.debug("Found pre-compiled GSP template [{}] for path [{}]", gspClassName, searchPath); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("Found pre-compiled GSP template [%s] for path [%s]", gspClassName, searchPath)); } Class gspClass = null; try { - if(LOG.isDebugEnabled()) { - LOG.debug("Loading GSP template [{}]", gspClassName); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("Loading GSP template [%s]", gspClassName)); } gspClass = (Class) Class.forName(gspClassName, true, Thread.currentThread().getContextClassLoader()); } catch (ClassNotFoundException e) { - LOG.warn("Cannot load class " + gspClassName + ". Resuming on non-precompiled implementation.", e); + LOG.log(Level.WARNING, "Cannot load class " + gspClassName + ". Resuming on non-precompiled implementation.", e); } if (gspClass != null) { GroovyPageCompiledScriptSource groovyPageCompiledScriptSource = createGroovyPageCompiledScriptSource(uri, searchPath, gspClass); - if(LOG.isDebugEnabled()) { - LOG.debug("Returning new GSP script source for class [{}]", gspClassName); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("Returning new GSP script source for class [%s]", gspClassName)); } return groovyPageCompiledScriptSource; } diff --git a/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/GroovyPagesGrailsPlugin.groovy b/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/GroovyPagesGrailsPlugin.groovy index a41df58295..8f95b9ffdb 100644 --- a/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/GroovyPagesGrailsPlugin.groovy +++ b/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/GroovyPagesGrailsPlugin.groovy @@ -25,7 +25,7 @@ import grails.util.GrailsUtil import grails.util.Metadata import grails.web.pages.GroovyPagesUriService import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j +import groovy.util.logging.Log import org.grails.core.artefact.TagLibArtefactHandler import org.grails.gsp.GroovyPageResourceLoader import org.grails.gsp.GroovyPagesTemplateEngine @@ -54,7 +54,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver * @author Graeme Rocher * @since 1.1 */ -@Slf4j +@Log class GroovyPagesGrailsPlugin extends Plugin { public static final String GSP_RELOAD_INTERVAL = "grails.gsp.reload.interval" diff --git a/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy b/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy index df6c4764ea..497cbb15ec 100644 --- a/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy +++ b/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy @@ -20,7 +20,7 @@ import grails.config.Config import grails.core.support.GrailsConfigurationAware import grails.gsp.TagLib import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j +import groovy.util.logging.Log import org.grails.plugins.web.GrailsTagDateHelper import java.text.DateFormat @@ -48,7 +48,7 @@ import org.springframework.web.servlet.support.RequestDataValueProcessor * @author Graeme Rocher */ @TagLib -@Slf4j +@Log class FormTagLib implements ApplicationContextAware, InitializingBean, TagLibrary, GrailsConfigurationAware { private static final List DEFAULT_CURRENCY_CODES = ['EUR', 'XCD', 'USD', 'XOF', 'NOK', 'AUD', @@ -523,7 +523,7 @@ class FormTagLib implements ApplicationContextAware, InitializingBean, TagLibrar // Strip out any 'name' attribute, since this tag overrides it. if (attrs.name) { - log.warn "[actionSubmit] 'name' attribute will be ignored" + log.warning "[actionSubmit] 'name' attribute will be ignored" attrs.remove('name') } diff --git a/grails-taglib/src/main/groovy/org/grails/core/artefact/gsp/TagLibArtefactHandler.java b/grails-taglib/src/main/groovy/org/grails/core/artefact/gsp/TagLibArtefactHandler.java index af8a8e54a2..7ae6c8ecff 100644 --- a/grails-taglib/src/main/groovy/org/grails/core/artefact/gsp/TagLibArtefactHandler.java +++ b/grails-taglib/src/main/groovy/org/grails/core/artefact/gsp/TagLibArtefactHandler.java @@ -17,13 +17,13 @@ import java.util.HashMap; import java.util.Map; +import java.util.logging.Logger; import grails.core.ArtefactHandlerAdapter; import grails.core.ArtefactInfo; import grails.core.GrailsClass; import grails.core.gsp.GrailsTagLibClass; import org.grails.core.gsp.DefaultGrailsTagLibClass; -import org.slf4j.LoggerFactory; /** * Configures tag libraries within namespaces in Grails. @@ -69,9 +69,11 @@ public void initialize(ArtefactInfo artefacts) { else { GrailsTagLibClass current = tag2libMap.get(tagName); if (!taglibClass.equals(current)) { - LoggerFactory.getLogger(TagLibArtefactHandler.class).info("There are conflicting tags: " + taglibClass.getFullName() + "." + - tagName + " vs. " + current.getFullName() + "." + tagName + - ". The former will take precedence."); + Logger.getLogger(TagLibArtefactHandler.class.getName()).info( + "There are conflicting tags: " + taglibClass.getFullName() + "." + + tagName + " vs. " + current.getFullName() + "." + tagName + + ". The former will take precedence." + ); tag2libMap.put(tagName, taglibClass); } } diff --git a/grails-taglib/src/main/groovy/org/grails/taglib/encoder/WithCodecHelper.groovy b/grails-taglib/src/main/groovy/org/grails/taglib/encoder/WithCodecHelper.groovy index 615d3bf69f..5deaa6abb2 100644 --- a/grails-taglib/src/main/groovy/org/grails/taglib/encoder/WithCodecHelper.groovy +++ b/grails-taglib/src/main/groovy/org/grails/taglib/encoder/WithCodecHelper.groovy @@ -17,7 +17,6 @@ package org.grails.taglib.encoder import groovy.transform.CompileStatic import grails.core.GrailsApplication -import groovy.util.logging.Slf4j import org.grails.encoder.CodecLookupHelper import org.grails.encoder.Encoder import org.grails.taglib.encoder.OutputEncodingStackAttributes.Builder @@ -29,7 +28,6 @@ import org.grails.taglib.encoder.OutputEncodingStackAttributes.Builder * @since 2.3 */ @CompileStatic -@Slf4j class WithCodecHelper { /** all is the key to set all codecs at once */ diff --git a/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java b/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java index 50c073907c..1063a3ef1a 100644 --- a/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java +++ b/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java @@ -24,8 +24,6 @@ import org.grails.gsp.io.GroovyPageScriptSource; import org.grails.web.gsp.io.GrailsConventionGroovyPageLocator; import org.grails.web.servlet.mvc.GrailsWebRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.core.Ordered; @@ -39,6 +37,8 @@ import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Evaluates the existance of a view for different extensions choosing which one to delegate to. @@ -47,7 +47,7 @@ * @since 0.1 */ public class GroovyPageViewResolver extends InternalResourceViewResolver implements GrailsViewResolver { - private static final Logger LOG = LoggerFactory.getLogger(GroovyPageViewResolver.class); + private static final Logger LOG = Logger.getLogger(GroovyPageViewResolver.class.getName()); public static final String GSP_SUFFIX = ".gsp"; public static final String JSP_SUFFIX = ".jsp"; @@ -187,14 +187,14 @@ protected View createGrailsView(String viewName) throws Exception { GroovyPageScriptSource scriptSource; if (controller == null) { - if(LOG.isDebugEnabled()) { - LOG.debug("Locating GSP view for path {}", viewName); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("Locating GSP view for path %s", viewName)); } scriptSource = groovyPageLocator.findViewByPath(viewName); } else { - if(LOG.isDebugEnabled()) { - LOG.debug("Locating GSP view for controller {} and path {}",controller, viewName); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("Locating GSP view for controller %s and path %s", controller, viewName)); } scriptSource = groovyPageLocator.findView(controller, viewName); } From a37181f358a4afefcb9c81e7ab9b3c775e7f5a69 Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Mon, 11 Nov 2024 15:21:56 -0800 Subject: [PATCH 2/2] slf4j conversion --- .../web/servlet/view/GroovyPageViewResolver.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java b/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java index 1063a3ef1a..145d109dd0 100644 --- a/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java +++ b/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java @@ -207,8 +207,8 @@ protected View createGrailsView(String viewName) throws Exception { private View createGroovyPageView(String gspView, ScriptSource scriptSource) { - if (LOG.isDebugEnabled()) { - LOG.debug("Resolved GSP view at URI [" + gspView + "]"); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("Resolved GSP view at URI [" + gspView + "]"); } GroovyPageView gspSpringView = new GroovyPageView(); gspSpringView.setServletContext(getServletContext()); @@ -218,8 +218,8 @@ private View createGroovyPageView(String gspView, ScriptSource scriptSource) { gspSpringView.setScriptSource(scriptSource); try { gspSpringView.afterPropertiesSet(); - if (LOG.isDebugEnabled()) { - LOG.debug("Initialized GSP view for URI [{}]", gspView); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("Initialized GSP view for URI [%s]", gspView)); } } catch (Exception e) { throw new RuntimeException("Error initializing GroovyPageView", e); @@ -228,9 +228,9 @@ private View createGroovyPageView(String gspView, ScriptSource scriptSource) { } protected View createFallbackView(String viewName) throws Exception { - if(resolveJspView) { - if(LOG.isDebugEnabled()) { - LOG.debug("No GSP view found, falling back to locating JSTL view for name [{}]", viewName); + if (resolveJspView) { + if (LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("No GSP view found, falling back to locating JSTL view for name [%s]", viewName)); } return createJstlView(viewName); }