From 3007edf77cde2707edaa255f5f00960ae3c8160d Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Wed, 4 Sep 2024 10:42:38 +0200 Subject: [PATCH] remove groovy files Signed-off-by: Ceki Gulcu --- .../classic/boolex/EvaluatorTemplate.groovy | 39 --- .../classic/gaffer/AppenderDelegate.groovy | 48 --- .../classic/gaffer/ComponentDelegate.groovy | 153 --------- .../gaffer/ConfigurationContributor.groovy | 31 -- .../gaffer/ConfigurationDelegate.groovy | 248 -------------- .../classic/gaffer/GafferConfigurator.groovy | 103 ------ .../logback/classic/gaffer/NestedType.groovy | 23 -- .../classic/gaffer/PropertyUtil.groovy | 96 ------ .../gaffer/ConfigurationDelegateTest.groovy | 317 ------------------ .../gaffer/GafferConfiguratorTest.groovy | 194 ----------- .../classic/gaffer/PropertyUtilTest.groovy | 39 --- .../issues/logback811/LineNumTest.groovy | 30 -- .../groovy/issues/logback811/logback._groovy | 12 - 13 files changed, 1333 deletions(-) delete mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/boolex/EvaluatorTemplate.groovy delete mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/AppenderDelegate.groovy delete mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ComponentDelegate.groovy delete mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationContributor.groovy delete mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy delete mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/GafferConfigurator.groovy delete mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/NestedType.groovy delete mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/PropertyUtil.groovy delete mode 100644 logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy delete mode 100644 logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/GafferConfiguratorTest.groovy delete mode 100644 logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/PropertyUtilTest.groovy delete mode 100644 logback-classic/src/test/groovy/issues/logback811/LineNumTest.groovy delete mode 100644 logback-classic/src/test/groovy/issues/logback811/logback._groovy diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/boolex/EvaluatorTemplate.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/boolex/EvaluatorTemplate.groovy deleted file mode 100644 index 2dcfc081c8..0000000000 --- a/logback-classic/src/main/groovy/ch/qos/logback/classic/boolex/EvaluatorTemplate.groovy +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.boolex - -import ch.qos.logback.classic.spi.ILoggingEvent - -import static ch.qos.logback.classic.Level.TRACE; -import static ch.qos.logback.classic.Level.DEBUG; -import static ch.qos.logback.classic.Level.INFO; -import static ch.qos.logback.classic.Level.WARN; -import static ch.qos.logback.classic.Level.ERROR; - -// WARNING -// If this file is renamed, this should be reflected in -// logback-classic/pom.xml resources section. - -/** - * @author Ceki Gücü - */ -public class EvaluatorTemplate implements IEvaluator { - - boolean doEvaluate(ILoggingEvent event) { - ILoggingEvent e = event; - //EXPRESSION - } - - -} diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/AppenderDelegate.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/AppenderDelegate.groovy deleted file mode 100644 index a104bce2fa..0000000000 --- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/AppenderDelegate.groovy +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer -import java.util.List; -import java.util.Map; - -import ch.qos.logback.core.Appender -import ch.qos.logback.core.spi.AppenderAttachable; - -/** - * @author Ceki Gücü - */ -class AppenderDelegate extends ComponentDelegate { - - Map> appendersByName = [:] - - AppenderDelegate(Appender appender) { - super(appender) - } - - AppenderDelegate(Appender appender, List> appenders) { - super(appender) - appendersByName = appenders.collectEntries { [(it.name) : it]} - } - - String getLabel() { - "appender" - } - - void appenderRef(String name){ - if (!AppenderAttachable.class.isAssignableFrom(component.class)) { - def errorMessage= component.class.name + ' does not implement ' + AppenderAttachable.class.name + '.' - throw new IllegalArgumentException(errorMessage) - } - component.addAppender(appendersByName[name]) - } -} diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ComponentDelegate.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ComponentDelegate.groovy deleted file mode 100644 index 533ef6c5bb..0000000000 --- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ComponentDelegate.groovy +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer - -import ch.qos.logback.core.spi.ContextAwareBase -import ch.qos.logback.core.spi.LifeCycle -import ch.qos.logback.core.spi.ContextAware -import ch.qos.logback.core.joran.spi.NoAutoStartUtil - -/** - * @author Ceki Gücü - */ -class ComponentDelegate extends ContextAwareBase { - - final Object component; - - final List fieldsToCascade = []; - - ComponentDelegate(Object component) { - this.component = component; - } - - String getLabel() { "component" } - - String getLabelFistLetterInUpperCase() { getLabel()[0].toUpperCase() + getLabel().substring(1) } - - void methodMissing(String name, def args) { - NestingType nestingType = PropertyUtil.nestingType(component, name, null); - if (nestingType == NestingType.NA) { - addError("${getLabelFistLetterInUpperCase()} ${getComponentName()} of type [${component.getClass().canonicalName}] has no appplicable [${name}] property.") - return; - } - - String subComponentName - Class clazz - Closure closure - - (subComponentName, clazz, closure) = analyzeArgs(args) - if (clazz != null) { - Object subComponent = clazz.newInstance() - if (subComponentName && subComponent.hasProperty(name)) { - subComponent.name = subComponentName; - } - if (subComponent instanceof ContextAware) { - subComponent.context = context; - } - if (closure) { - ComponentDelegate subDelegate = new ComponentDelegate(subComponent) - - cascadeFields(subDelegate) - subDelegate.context = context - injectParent(subComponent) - closure.delegate = subDelegate - closure.resolveStrategy = Closure.DELEGATE_FIRST - closure() - } - if (subComponent instanceof LifeCycle && NoAutoStartUtil.notMarkedWithNoAutoStart(subComponent)) { - subComponent.start(); - } - PropertyUtil.attach(nestingType, component, subComponent, name) - } else { - addError("No 'class' argument specified for [${name}] in ${getLabel()} ${getComponentName()} of type [${component.getClass().canonicalName}]"); - } - } - - void cascadeFields(ComponentDelegate subDelegate) { - for (String k: fieldsToCascade) { - subDelegate.metaClass."${k}" = this."${k}" - } - } - - void injectParent(Object subComponent) { - if(subComponent.hasProperty("parent")) { - subComponent.parent = component; - } - } - - void propertyMissing(String name, def value) { - NestingType nestingType = PropertyUtil.nestingType(component, name, value); - if (nestingType == NestingType.NA) { - addError("${getLabelFistLetterInUpperCase()} ${getComponentName()} of type [${component.getClass().canonicalName}] has no appplicable [${name}] property ") - return; - } - PropertyUtil.attach(nestingType, component, value, name) - } - - - def analyzeArgs(Object[] args) { - String name; - Class clazz; - Closure closure; - - if (args.size() > 3) { - addError("At most 3 arguments allowed but you passed $args") - return [name, clazz, closure] - } - - if (args[-1] instanceof Closure) { - closure = args[-1] - args -= args[-1] - } - - if (args.size() == 1) { - clazz = parseClassArgument(args[0]) - } - - if (args.size() == 2) { - name = parseNameArgument(args[0]) - clazz = parseClassArgument(args[1]) - } - - return [name, clazz, closure] - } - - Class parseClassArgument(arg) { - if (arg instanceof Class) { - return arg - } else if (arg instanceof String) { - return Class.forName(arg) - } else { - addError("Unexpected argument type ${arg.getClass().canonicalName}") - return null; - } - } - - String parseNameArgument(arg) { - if (arg instanceof String) { - return arg - } else { - addError("With 2 or 3 arguments, the first argument must be the component name, i.e of type string") - return null; - } - } - - String getComponentName() { - if (component.hasProperty("name")) - return "[${component.name}]" - else - return "" - - } -} \ No newline at end of file diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationContributor.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationContributor.groovy deleted file mode 100644 index 17739f0fdd..0000000000 --- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationContributor.groovy +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer - -/** - * @author Ceki Gücü - */ -public interface ConfigurationContributor { - - /** - * The list of method mapping from the contributor into the configuration mechanism, - * e.g. the ConfiguratorDelegate - * - *

The key in the map is the method being contributed and the value is the name of - * the method in the target class. - * @return - */ - public Map getMappings() - -} diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy deleted file mode 100644 index 67515affa6..0000000000 --- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy +++ /dev/null @@ -1,248 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer; - - -import ch.qos.logback.classic.Level -import ch.qos.logback.classic.Logger -import ch.qos.logback.classic.LoggerContext -import ch.qos.logback.classic.jmx.JMXConfigurator -import ch.qos.logback.classic.jmx.MBeanUtil -import ch.qos.logback.classic.joran.ReconfigureOnChangeTask; -import ch.qos.logback.classic.net.ReceiverBase -import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter -import ch.qos.logback.classic.turbo.TurboFilter -import ch.qos.logback.core.Appender -import ch.qos.logback.core.CoreConstants -import ch.qos.logback.core.spi.ContextAwareBase -import ch.qos.logback.core.status.StatusListener -import ch.qos.logback.core.util.CachingDateFormatter -import ch.qos.logback.core.util.Duration -import ch.qos.logback.core.spi.LifeCycle -import ch.qos.logback.core.spi.ContextAware - -import javax.management.MalformedObjectNameException -import javax.management.ObjectName - -import java.lang.management.ManagementFactory -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -/** - * @author Ceki Gücü - */ - -public class ConfigurationDelegate extends ContextAwareBase { - - List appenderList = []; - - Object getDeclaredOrigin() { - return this; - } - - void scan(String scanPeriodStr = null) { - if (scanPeriodStr) { - ReconfigureOnChangeTask rocTask = new ReconfigureOnChangeTask(); - rocTask.setContext(context); - context.putObject(CoreConstants.RECONFIGURE_ON_CHANGE_TASK, rocTask); - try { - Duration duration = Duration.valueOf(scanPeriodStr); - ScheduledExecutorService scheduledExecutorService = context.getScheduledExecutorService(); - - ScheduledFuture scheduledFuture = scheduledExecutorService.scheduleAtFixedRate(rocTask, duration.getMilliseconds(), duration.getMilliseconds(), TimeUnit.MILLISECONDS); - context.addScheduledFuture(scheduledFuture); - addInfo("Setting ReconfigureOnChangeTask scanning period to " + duration); - } catch (NumberFormatException nfe) { - addError("Error while converting [" + scanPeriodStr + "] to long", nfe); - } - } - } - - void statusListener(Class listenerClass) { - StatusListener statusListener = listenerClass.newInstance() - context.statusManager.add(statusListener) - if(statusListener instanceof ContextAware) { - ((ContextAware) statusListener).setContext(context); - } - if(statusListener instanceof LifeCycle) { - ((LifeCycle) statusListener).start(); - } - addInfo("Added status listener of type [${listenerClass.canonicalName}]"); - } - - void conversionRule(String conversionWord, Class converterClass) { - String converterClassName = converterClass.getName(); - - Map ruleRegistry = (Map) context.getObject(CoreConstants.PATTERN_RULE_REGISTRY); - if (ruleRegistry == null) { - ruleRegistry = new HashMap(); - context.putObject(CoreConstants.PATTERN_RULE_REGISTRY, ruleRegistry); - } - // put the new rule into the rule registry - addInfo("registering conversion word " + conversionWord + " with class [" + converterClassName + "]"); - ruleRegistry.put(conversionWord, converterClassName); - } - - void root(Level level, List appenderNames = []) { - if (level == null) { - addError("Root logger cannot be set to level null"); - } else { - logger(org.slf4j.Logger.ROOT_LOGGER_NAME, level, appenderNames); - } - } - - void logger(String name, Level level, List appenderNames = [], Boolean additivity = null) { - if (name) { - Logger logger = ((LoggerContext) context).getLogger(name); - addInfo("Setting level of logger [${name}] to " + level); - logger.level = level; - - for (aName in appenderNames) { - Appender appender = appenderList.find { it -> it.name == aName }; - if (appender != null) { - addInfo("Attaching appender named [${aName}] to " + logger); - logger.addAppender(appender); - } else { - addError("Failed to find appender named [${aName}]"); - } - } - - if (additivity != null) { - logger.additive = additivity; - } - } else { - addInfo("No name attribute for logger"); - } - } - - void appender(String name, Class clazz, Closure closure = null) { - addInfo("About to instantiate appender of type [" + clazz.name + "]"); - Appender appender = clazz.newInstance(); - addInfo("Naming appender as [" + name + "]"); - appender.name = name - appender.context = context - appenderList.add(appender) - if (closure != null) { - AppenderDelegate ad = new AppenderDelegate(appender, appenderList) - copyContributions(ad, appender) - ad.context = context; - closure.delegate = ad; - closure.resolveStrategy = Closure.DELEGATE_FIRST - closure(); - } - try { - appender.start() - } catch (RuntimeException e) { - addError("Failed to start apppender named [" + name + "]", e) - } - } - - void receiver(String name, Class aClass, Closure closure = null) { - addInfo("About to instantiate receiver of type [" + clazz.name + "]"); - ReceiverBase receiver = aClass.newInstance(); - receiver.context = context; - if(closure != null) { - ComponentDelegate componentDelegate = new ComponentDelegate(receiver); - componentDelegate.context = context; - closure.delegate = componentDelegate; - closure.resolveStrategy = Closure.DELEGATE_FIRST - closure(); - } - try { - receiver.start() - } catch (RuntimeException e) { - addError("Failed to start receiver of type [" + aClass.getName() + "]", e) - } - } - - private void copyContributions(AppenderDelegate appenderDelegate, Appender appender) { - if (appender instanceof ConfigurationContributor) { - ConfigurationContributor cc = (ConfigurationContributor) appender; - cc.getMappings().each() { oldName, newName -> - appenderDelegate.metaClass."${newName}" = appender.&"$oldName" - } - } - } - - void turboFilter(Class clazz, Closure closure = null) { - addInfo("About to instantiate turboFilter of type [" + clazz.name + "]"); - TurboFilter turboFilter = clazz.newInstance(); - turboFilter.context = context - - if (closure != null) { - ComponentDelegate componentDelegate = new ComponentDelegate(turboFilter); - componentDelegate.context = context; - closure.delegate = componentDelegate; - closure.resolveStrategy = Closure.DELEGATE_FIRST - closure(); - } - turboFilter.start(); - addInfo("Adding aforementioned turbo filter to context"); - context.addTurboFilter(turboFilter) - } - - String timestamp(String datePattern, long timeReference = -1) { - long now = -1; - - if (timeReference == -1) { - addInfo("Using current interpretation time, i.e. now, as time reference."); - now = System.currentTimeMillis() - } else { - now = timeReference - addInfo("Using " + now + " as time reference."); - } - CachingDateFormatter sdf = new CachingDateFormatter(datePattern); - sdf.format(now) - } - - /** - * Creates and registers a {@link JMXConfigurator} with the platform MBean Server. - * Allows specifying a custom context name to derive the used ObjectName, or a complete - * ObjectName string representation to determine your own (the syntax automatically determines the intent). - * - * @param name custom context name or full ObjectName string representation (defaults to null) - */ - void jmxConfigurator(String name = null) { - def objectName = null - def contextName = context.name - if (name != null) { - // check if this is a valid ObjectName - try { - objectName = new ObjectName(name) - } catch (MalformedObjectNameException e) { - contextName = name - } - } - if (objectName == null) { - def objectNameAsStr = MBeanUtil.getObjectNameFor(contextName, JMXConfigurator.class) - objectName = MBeanUtil.string2ObjectName(context, this, objectNameAsStr) - if (objectName == null) { - addError("Failed to construct ObjectName for [${objectNameAsStr}]") - return - } - } - - def platformMBeanServer = ManagementFactory.platformMBeanServer - if (!MBeanUtil.isRegistered(platformMBeanServer, objectName)) { - JMXConfigurator jmxConfigurator = new JMXConfigurator((LoggerContext) context, platformMBeanServer, objectName) - try { - platformMBeanServer.registerMBean(jmxConfigurator, objectName) - } catch (all) { - addError("Failed to create mbean", all) - } - } - } - -} diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/GafferConfigurator.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/GafferConfigurator.groovy deleted file mode 100644 index 2b28514842..0000000000 --- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/GafferConfigurator.groovy +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer - -import ch.qos.logback.classic.Level -import ch.qos.logback.classic.LoggerContext -import ch.qos.logback.classic.encoder.PatternLayoutEncoder -import ch.qos.logback.classic.sift.SiftingAppender -import ch.qos.logback.core.status.OnConsoleStatusListener -import ch.qos.logback.core.util.ContextUtil -import ch.qos.logback.core.util.OptionHelper - -import ch.qos.logback.core.joran.util.ConfigurationWatchListUtil -import org.codehaus.groovy.control.CompilerConfiguration -import org.codehaus.groovy.control.customizers.ImportCustomizer - -class GafferConfigurator { - - LoggerContext context - - static final String DEBUG_SYSTEM_PROPERTY_KEY = "logback.debug"; - - GafferConfigurator(LoggerContext context) { - this.context = context - } - - protected void informContextOfURLUsedForConfiguration(URL url) { - ConfigurationWatchListUtil.setMainWatchURL(context, url); - } - - void run(URL url) { - informContextOfURLUsedForConfiguration(url); - run(url.text); - } - - void run(File file) { - informContextOfURLUsedForConfiguration(file.toURI().toURL()); - run(file.text); - } - - void run(String dslText) { - Binding binding = new Binding(); - binding.setProperty("hostname", ContextUtil.localHostName); - - def configuration = new CompilerConfiguration() - configuration.addCompilationCustomizers(importCustomizer()) - - String debugAttrib = System.getProperty(DEBUG_SYSTEM_PROPERTY_KEY); - if (OptionHelper.isEmpty(debugAttrib) || debugAttrib.equalsIgnoreCase("false") - || debugAttrib.equalsIgnoreCase("null")) { - // For now, Groovy/Gaffer configuration DSL does not support "debug" attribute. But in order to keep - // the conditional logic identical to that in XML/Joran, we have this empty block. - } else { - OnConsoleStatusListener.addNewInstanceToContext(context); - } - - // caller data should take into account groovy frames - new ContextUtil(context).addGroovyPackages(context.getFrameworkPackages()); - - Script dslScript = new GroovyShell(binding, configuration).parse(dslText) - - dslScript.metaClass.mixin(ConfigurationDelegate) - dslScript.setContext(context) - dslScript.metaClass.getDeclaredOrigin = { dslScript } - - dslScript.run() - } - - protected ImportCustomizer importCustomizer() { - def customizer = new ImportCustomizer() - - - def core = 'ch.qos.logback.core' - customizer.addStarImports(core, "${core}.encoder", "${core}.read", "${core}.rolling", "${core}.status", - "ch.qos.logback.classic.net") - - customizer.addImports(PatternLayoutEncoder.class.name) - - customizer.addStaticStars(Level.class.name) - - customizer.addStaticImport('off', Level.class.name, 'OFF') - customizer.addStaticImport('error', Level.class.name, 'ERROR') - customizer.addStaticImport('warn', Level.class.name, 'WARN') - customizer.addStaticImport('info', Level.class.name, 'INFO') - customizer.addStaticImport('debug', Level.class.name, 'DEBUG') - customizer.addStaticImport('trace', Level.class.name, 'TRACE') - customizer.addStaticImport('all', Level.class.name, 'ALL') - - customizer - } - -} \ No newline at end of file diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/NestedType.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/NestedType.groovy deleted file mode 100644 index 6924e50b15..0000000000 --- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/NestedType.groovy +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer - -/** - * @author Ceki Gücü - */ - -enum NestingType { - NA, SINGLE, SINGLE_WITH_VALUE_OF_CONVENTION, AS_COLLECTION; -} - diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/PropertyUtil.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/PropertyUtil.groovy deleted file mode 100644 index 1bdb9d184b..0000000000 --- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/PropertyUtil.groovy +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer - -import java.lang.reflect.Method - -import com.sun.org.apache.xpath.internal.axes.SubContextList; - -import ch.qos.logback.core.joran.util.StringToObjectConverter; -import ch.qos.logback.core.joran.util.beans.BeanUtil - -/** - * @author Ceki Gücü - */ -class PropertyUtil { - - static boolean hasAdderMethod(Object obj, String name) { - String addMethod = "add${upperCaseFirstLetter(name)}"; - return obj.metaClass.respondsTo(obj, addMethod); - } - - - static NestingType nestingType(Object obj, String name, Object value) { - def decapitalizedName = BeanUtil.toLowerCamelCase(name); - MetaProperty metaProperty = obj.hasProperty(decapitalizedName); - - if(metaProperty != null) { - boolean VALUE_IS_A_STRING = value instanceof String; - - if(VALUE_IS_A_STRING && StringToObjectConverter.followsTheValueOfConvention(metaProperty.getType())) { - return NestingType.SINGLE_WITH_VALUE_OF_CONVENTION; - } else { - return NestingType.SINGLE; - } - } - if (hasAdderMethod(obj, name)) { - return NestingType.AS_COLLECTION; - } - return NestingType.NA; - } - - static Object convertByValueMethod(Object component, String name, String value) { - def decapitalizedName = BeanUtil.toLowerCamelCase(name); - MetaProperty metaProperty = component.hasProperty(decapitalizedName); - Method valueOfMethod = StringToObjectConverter.getValueOfMethod(metaProperty.getType()); - return valueOfMethod.invoke(null, value); - } - - static void attach(NestingType nestingType, Object component, Object subComponent, String name) { - switch (nestingType) { - case NestingType.SINGLE_WITH_VALUE_OF_CONVENTION: - name = BeanUtil.toLowerCamelCase(name); - Object value = convertByValueMethod(component, name, subComponent); - component."${name}" = value; - break; - case NestingType.SINGLE: - name = BeanUtil.toLowerCamelCase(name); - component."${name}" = subComponent; - break; - - case NestingType.AS_COLLECTION: - String firstUpperName = PropertyUtil.upperCaseFirstLetter(name) - component."add${firstUpperName}"(subComponent); - break; - } - } - - static String transformFirstLetter(String s, Closure closure) { - if (s == null || s.length() == 0) - return s; - - String firstLetter = new String(s.getAt(0)); - - String modifiedFistLetter = closure(firstLetter); - - if (s.length() == 1) - return modifiedFistLetter - else - return modifiedFistLetter + s.substring(1); - } - - static String upperCaseFirstLetter(String s) { - return transformFirstLetter(s, {String it -> it.toUpperCase()}) - } -} diff --git a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy deleted file mode 100644 index 040dd12c32..0000000000 --- a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer - -import ch.qos.logback.classic.LoggerContext -import org.junit.Before -import org.junit.Test - -import javax.management.InstanceNotFoundException -import javax.management.ObjectName -import java.lang.management.ManagementFactory - -import static org.junit.Assert.* - -import ch.qos.logback.classic.turbo.TurboFilter -import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter -import ch.qos.logback.classic.Level -import ch.qos.logback.core.testUtil.CoreTestConstants -import ch.qos.logback.core.testUtil.RandomUtil -import ch.qos.logback.core.status.testUtil.StatusChecker -import ch.qos.logback.classic.Logger -import ch.qos.logback.core.Appender -import ch.qos.logback.core.helpers.NOPAppender -import ch.qos.logback.core.ConsoleAppender -import ch.qos.logback.core.encoder.LayoutWrappingEncoder -import ch.qos.logback.classic.PatternLayout -import ch.qos.logback.core.util.FileSize -import ch.qos.logback.core.util.StatusPrinter -import ch.qos.logback.classic.net.SMTPAppender -import ch.qos.logback.core.rolling.RollingFileAppender -import ch.qos.logback.core.rolling.TimeBasedRollingPolicy -import ch.qos.logback.classic.encoder.PatternLayoutEncoder -import ch.qos.logback.core.rolling.SizeAndTimeBasedFileNamingAndTriggeringPolicy -import ch.qos.logback.core.joran.action.TimestampAction - -/** - * @author Ceki Gücü - */ -class ConfigurationDelegateTest { - - LoggerContext context = new LoggerContext() - ConfigurationDelegate configurationDelegate = new ConfigurationDelegate(); - StatusChecker statusChecker = new StatusChecker(context) - int diff = RandomUtil.getPositiveInt(); - - String randomOutputDir = CoreTestConstants.OUTPUT_DIR_PREFIX + diff + "/"; - - @Before - void setUp() { - context.name = "ConfigurationDelegateTest" - configurationDelegate.context = context; - } - - @Test - void contextAwareMixin() { - configurationDelegate.addInfo("smoke") - assertTrue(statusChecker.containsMatch("smoke")) - } - - @Test - void scan() { - configurationDelegate.scan("10seconds") - assertTrue(statusChecker.containsMatch("Setting ReconfigureOnChangeTask")) - } - - @Test - void timestamp() { - String result = configurationDelegate.timestamp("yyyy") - long year = Calendar.getInstance().get(Calendar.YEAR); - assertEquals(year.toString(), result) - } - - @Test - void timestampWithContextBirthAsReference() { - String result = configurationDelegate.timestamp("yyyy", context.birthTime) - long year = Calendar.getInstance().get(Calendar.YEAR); - assertEquals(year.toString(), result) - } - - - @Test - void loggerWithoutName() { - configurationDelegate.logger("", Level.DEBUG) - assertTrue(statusChecker.containsMatch("No name attribute for logger")) - } - - @Test - void loggerSetLevel() { - configurationDelegate.logger("setLevel" + diff, Level.INFO) - Logger smokeLogger = context.getLogger("setLevel" + diff); - assertEquals(Level.INFO, smokeLogger.level) - } - - - @Test - void loggerAppenderRef() { - Appender fooAppender = new NOPAppender(); - fooAppender.name = "FOO" - configurationDelegate.appenderList = [fooAppender] - configurationDelegate.logger("test" + diff, Level.INFO, ["FOO"]) - Logger logger = context.getLogger("test" + diff); - assertEquals(Level.INFO, logger.level) - assertEquals(fooAppender, logger.getAppender("FOO")) - } - - @Test - void loggerAdditivity() { - Appender fooAppender = new NOPAppender(); - fooAppender.name = "FOO" - configurationDelegate.appenderList = [fooAppender] - configurationDelegate.logger("test" + diff, Level.INFO, ["FOO"], false) - Logger logger = context.getLogger("test" + diff); - assertEquals(Level.INFO, logger.level) - assertEquals(fooAppender, logger.getAppender("FOO")) - assertEquals(false, logger.additive) - } - - @Test - void loggerAdditivittWithEmptyList() { - configurationDelegate.logger("test" + diff, Level.INFO, [], false) - Logger logger = context.getLogger("test" + diff); - assertEquals(Level.INFO, logger.level) - assertEquals(null, logger.getAppender("FOO")) - assertEquals(false, logger.additive) - } - - @Test - void root_LEVEL() { - configurationDelegate.root(Level.ERROR) - Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME); - assertEquals(Level.ERROR, root.level) - assertEquals(null, root.getAppender("FOO")) - } - - @Test - void root_WithList() { - Appender fooAppender = new NOPAppender(); - fooAppender.name = "FOO" - configurationDelegate.appenderList = [fooAppender] - configurationDelegate.root(Level.WARN, ["FOO"]) - Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME); - assertEquals(Level.WARN, root.level) - assertEquals(fooAppender, root.getAppender("FOO")) - } - - @Test - void appender0() { - configurationDelegate.appender("A", NOPAppender); - Appender back = configurationDelegate.appenderList.find {it.name = "A"} - assertNotNull(back) - assertEquals("A", back.name) - } - - @Test - void appender1() { - configurationDelegate.appender("C", ConsoleAppender) { - target = "System.err" - } - Appender back = configurationDelegate.appenderList.find {it.name = "C"} - assertNotNull(back) - assertEquals("C", back.name) - assertEquals("System.err", back.target) - } - - - @Test - void appenderWithEncoder() { - configurationDelegate.appender("C", ConsoleAppender) { - encoder(LayoutWrappingEncoder) { - layout(PatternLayout) { - pattern = "%m%n" - } - } - } - Appender back = configurationDelegate.appenderList.find {it.name = "C"} - assertNotNull(back) - assertEquals("C", back.name) - ConsoleAppender ca = back - assertNotNull(ca.encoder) - assertNotNull(ca.encoder.layout) - PatternLayout layout = ca.encoder.layout - assertEquals("%m%n", layout.pattern) - - } - - @Test - void appenderSMTP() { - configurationDelegate.appender("SMTP", SMTPAppender) { - to = "a" - to = "b" - layout(PatternLayout) { - pattern = "%m%n" - } - } - //StatusPrinter.print context - Appender back = configurationDelegate.appenderList.find {it.name = "SMTP"} - assertNotNull(back) - assertEquals("SMTP", back.name) - SMTPAppender sa = back - PatternLayout layout = sa.layout - assertEquals("%m%n", layout.pattern) - - assertEquals(["a%nopex", "b%nopex"], sa.getToAsListOfString().sort()); - } - - // test parent injection - - @Test - void appenderRolling() { - - String logFile = randomOutputDir + "log.txt"; - - configurationDelegate.appender("ROLLING", RollingFileAppender) { - file = logFile - rollingPolicy(TimeBasedRollingPolicy) { - fileNamePattern = randomOutputDir + "log.%d{yyyy-MM}.log.zip" - } - encoder(PatternLayoutEncoder) { - pattern = '%msg%n' - } - } - // StatusPrinter.print context - RollingFileAppender back = configurationDelegate.appenderList.find {it.name = "ROLLING"} - assertNotNull(back) - assertEquals(logFile, back.rollingPolicy.getParentsRawFileProperty()) - } - - - // See LOGBACK-458 - @Test - void withSizeAndTimeBasedFNATP() { - withSizeAndTimeBasedFNATP(false); - } - - // See LOGBACK-1232 - @Test - void withSizeAndTimeBasedFNATP_AsString() { - withSizeAndTimeBasedFNATP(true); - } - - void withSizeAndTimeBasedFNATP(boolean asString) { - String logFile = randomOutputDir + "log.txt"; - configurationDelegate.appender("ROLLING", RollingFileAppender) { - file = logFile - rollingPolicy(TimeBasedRollingPolicy) { - fileNamePattern = "mylog-%d{yyyy-MM-dd}.%i.txt" - timeBasedFileNamingAndTriggeringPolicy(SizeAndTimeBasedFileNamingAndTriggeringPolicy) { - if(asString) - maxFileSize = "100MB" - else - maxFileSize = FileSize.valueOf("100MB") - } - } - encoder(PatternLayoutEncoder) { - pattern = "%msg%n" - } - } - RollingFileAppender back = configurationDelegate.appenderList.find {it.name = "ROLLING"} - StatusPrinter.print(context) - assertNotNull(back) - assertEquals(logFile, back.rollingPolicy.getParentsRawFileProperty()) - assertTrue(back.rollingPolicy.timeBasedFileNamingAndTriggeringPolicy.isStarted()) - } - - @Test - void jmxConfiguratorWithDefaults() { - ObjectName name = new ObjectName( - "ch.qos.logback.classic:Name=ConfigurationDelegateTest,Type=ch.qos.logback.classic.jmx.JMXConfigurator") - try { - ManagementFactory.platformMBeanServer.getObjectInstance(name) - fail("Should not have found JMXConfigurator MBean") - } catch (InstanceNotFoundException expected) { - } - configurationDelegate.jmxConfigurator() - def mbean = ManagementFactory.platformMBeanServer.getObjectInstance(name) - assertNotNull(mbean) - } - - @Test - void jmxConfiguratorWithNonDefaultContextName() { - ObjectName name = new ObjectName( - "ch.qos.logback.classic:Name=CustomName,Type=ch.qos.logback.classic.jmx.JMXConfigurator") - try { - ManagementFactory.platformMBeanServer.getObjectInstance(name) - fail("Should not have found JMXConfigurator MBean") - } catch (InstanceNotFoundException expected) { - } - configurationDelegate.jmxConfigurator("CustomName") - def mbean = ManagementFactory.platformMBeanServer.getObjectInstance(name) - assertNotNull(mbean) - } - - @Test - void jmxConfiguratorWithNonDefaultObjectName() { - ObjectName name = new ObjectName("customDomain:Name=JMX") - try { - ManagementFactory.platformMBeanServer.getObjectInstance(name) - fail("Should not have found JMXConfigurator MBean") - } catch (InstanceNotFoundException expected) { - } - configurationDelegate.jmxConfigurator("customDomain:Name=JMX") - def mbean = ManagementFactory.platformMBeanServer.getObjectInstance(name) - assertNotNull(mbean) - } - -} diff --git a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/GafferConfiguratorTest.groovy b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/GafferConfiguratorTest.groovy deleted file mode 100644 index 74023d6ac2..0000000000 --- a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/GafferConfiguratorTest.groovy +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer - -import ch.qos.logback.classic.ClassicTestConstants -import ch.qos.logback.classic.LoggerContext -import org.junit.Before -import ch.qos.logback.core.testUtil.RandomUtil -import org.junit.Ignore -import org.junit.Test -import ch.qos.logback.classic.Logger -import ch.qos.logback.classic.Level -import static junit.framework.Assert.assertNotNull -import static junit.framework.Assert.assertEquals -import ch.qos.logback.core.ConsoleAppender -import ch.qos.logback.classic.AsyncAppender -import ch.qos.logback.classic.PatternLayout -import ch.qos.logback.classic.spi.ILoggingEvent -import ch.qos.logback.core.testUtil.StringListAppender -import ch.qos.logback.classic.testUtil.SampleConverter -import ch.qos.logback.core.util.StatusPrinter - -import ch.qos.logback.classic.boolex.JaninoEventEvaluator -import ch.qos.logback.core.filter.EvaluatorFilter -import ch.qos.logback.core.boolex.Matcher -import static org.junit.Assert.assertTrue - -/** - * @author Ceki Gücü - */ -class GafferConfiguratorTest { - - LoggerContext context = new LoggerContext(); - Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME) - Logger logger = context.getLogger(this.getClass()) - int diff = RandomUtil.getPositiveInt(); - GafferConfigurator configurator = new GafferConfigurator(context); - final shouldFail = new GroovyTestCase().&shouldFail - - @Before - void setUp() { - - } - - @Test - void smoke() { - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "smoke.groovy") - String dslText = file.text - configurator.run dslText - Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME); - assertEquals(Level.WARN, root.level) - assertNotNull(root.getAppender("C")) - ConsoleAppender ca = root.getAppender("C") - assertNotNull(ca.encoder) - assertNotNull(ca.encoder.layout) - PatternLayout layout = ca.encoder.layout - assertEquals("%m%n", layout.pattern) - } - - @Test - void onTheFly() { - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "onTheFly.groovy") - String dslText = file.text - configurator.run dslText - } - - @Test - void contextName() { - String dslText = "context.name = 'a'" - configurator.run dslText - assertEquals("a", context.name) - } - - @Test - void contextProperty() { - String dslText = "context.putProperty('x', 'a')" - configurator.run dslText - assertEquals("a", context.getProperty("x")) - } - - @Test - void conversionRule() { - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "conversionRule.groovy") - String dslText = file.text - configurator.run dslText - - StringListAppender sla = (StringListAppender) root.getAppender("LIST"); - assertNotNull(sla); - assertEquals(0, sla.strList.size()); - - assertEquals(Level.DEBUG, root.level); - - String msg = "Simon says"; - logger.debug(msg); - StatusPrinter.print context - assertEquals(1, sla.strList.size()); - assertEquals(SampleConverter.SAMPLE_STR + " - " + msg, sla.strList.get(0)); - } - - @Test - void evaluatorWithMatcher() { - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "evaluatorWithMatcher.groovy") - String dslText = file.text - configurator.run dslText - - ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT"); - assertTrue ca.isStarted() - - EvaluatorFilter ef = ca.getCopyOfAttachedFiltersList()[0]; - assertTrue ef.isStarted() - - JaninoEventEvaluator jee = ef.evaluator - assertTrue jee.isStarted() - Matcher m = jee.matcherList[0] - assertTrue m.isStarted() - } - - @Test - void propertyCascading0() { - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading0.groovy") - String dslText = file.text - configurator.run dslText - - ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT"); - assertTrue ca.isStarted() - - assertEquals("HELLO %m%n", ca.encoder.layout.pattern) - } - - @Test - void propertyCascading1() { - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading1.groovy") - String dslText = file.text - configurator.run dslText - - ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT"); - assertTrue ca.isStarted() - assertEquals("HELLO %m%n", ca.encoder.getLayout().pattern) - } - - @Test - void propertyCascading2() { - context.putProperty("p", "HELLO"); - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading2.groovy") - String dslText = file.text - configurator.run dslText - - ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT"); - assertTrue ca.isStarted() - assertEquals("HELLO %m%n", ca.encoder.getLayout().pattern) - } - - - @Test - @Ignore - void receiver() { - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading2.groovy") - String dslText = file.text - configurator.run dslText - } - - @Test - void appenderRefShouldWork() { - context.putProperty("p", "HELLO"); - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "asyncAppender.groovy") - configurator.run file.text - - def aa = (AsyncAppender) root.getAppender('STDOUT-ASYNC'); - assertTrue aa.isStarted() - def stdout = (ConsoleAppender) aa.getAppender('STDOUT') - assertNotNull stdout - } - - @Test - void appenderRefWithNonAppenderAttachable() { - context.putProperty("p", "HELLO"); - String message = shouldFail(IllegalArgumentException) { - File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "appenderRefWithNonAppenderAttachable.groovy") - configurator.run file.text - } - assertEquals message, "ch.qos.logback.core.ConsoleAppender does not implement ch.qos.logback.core.spi.AppenderAttachable." - } -} diff --git a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/PropertyUtilTest.groovy b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/PropertyUtilTest.groovy deleted file mode 100644 index 17a7d54732..0000000000 --- a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/PropertyUtilTest.groovy +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package ch.qos.logback.classic.gaffer - -import org.junit.Test -import static junit.framework.Assert.assertEquals - -/** - * @author Ceki Gücü - */ -class PropertyUtilTest { - - - @Test - void empty() { - assertEquals("", PropertyUtil.upperCaseFirstLetter("")); - assertEquals(null, PropertyUtil.upperCaseFirstLetter(null)); - } - - - - @Test - void smoke() { - assertEquals("Hello", PropertyUtil.upperCaseFirstLetter("hello")); - } - - -} diff --git a/logback-classic/src/test/groovy/issues/logback811/LineNumTest.groovy b/logback-classic/src/test/groovy/issues/logback811/LineNumTest.groovy deleted file mode 100644 index 93cda53dae..0000000000 --- a/logback-classic/src/test/groovy/issues/logback811/LineNumTest.groovy +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Logback: the reliable, generic, fast and flexible logging framework. - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. - * - * This program and the accompanying materials are dual-licensed under - * either the terms of the Eclipse Public License v1.0 as published by - * the Eclipse Foundation - * - * or (per the licensee's choosing) - * - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. - */ -package issues.logback811 - -import ch.qos.logback.core.util.StatusPrinter -import org.junit.Test -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -class LineNumTest { - - // move logback.groovy to src/test/resources and runManually() - - @Test - void runMannually() { - Logger logger = LoggerFactory.getLogger(this.class) - logger.debug("hello from logger on line 28") - } -} diff --git a/logback-classic/src/test/groovy/issues/logback811/logback._groovy b/logback-classic/src/test/groovy/issues/logback811/logback._groovy deleted file mode 100644 index 716212633d..0000000000 --- a/logback-classic/src/test/groovy/issues/logback811/logback._groovy +++ /dev/null @@ -1,12 +0,0 @@ - -import ch.qos.logback.classic.encoder.PatternLayoutEncoder -import ch.qos.logback.core.ConsoleAppender -import static ch.qos.logback.classic.Level.* - -appender("STDOUT", ConsoleAppender) { - encoder(PatternLayoutEncoder) { - pattern = "%date [%-5level] [%4.4line] - %msg%n" - } -} - -root(DEBUG, ["STDOUT"]) \ No newline at end of file