From c8cd9aa397d7fe7060ea0ed1666bf53e21cb3fdb Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Fri, 5 Jan 2024 19:42:33 +0100 Subject: [PATCH 1/3] update license in some old files not part of the ditributed binary Signed-off-by: Ceki Gulcu Signed-off-by: xuwenping --- .../ch/qos/logback/classic/LoggerCreation.java | 14 +++++++++----- .../logback/classic/LoggerEventCreationTest.java | 13 +++++++++++++ .../classic/RetreivalOfExistingLoggerSpeed.java | 14 +++++++++----- .../qos/logback/classic/SpeedOfDisabledDebug.java | 14 +++++++++----- .../classic/pattern/ClassNameAbbreviatorSpeed.java | 14 +++++++++----- .../ch/qos/logback/classic/pattern/WriteSpeed.java | 14 +++++++++----- .../src/java/ch/qos/logback/reflect/Fruit.java | 13 +++++++++++++ .../src/java/ch/qos/logback/reflect/JEXLTest.java | 13 +++++++++++++ .../java/ch/qos/logback/reflect/JaninoTest.java | 13 +++++++++++++ .../ch/qos/logback/reflect/ReflectionSpeed.java | 13 +++++++++++++ logback-core/src/test/input/compress3.copy | 8 -------- 11 files changed, 110 insertions(+), 33 deletions(-) diff --git a/logback-classic/performance/src/java/ch/qos/logback/classic/LoggerCreation.java b/logback-classic/performance/src/java/ch/qos/logback/classic/LoggerCreation.java index bdd4ba14ba..4f4db4a58e 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/classic/LoggerCreation.java +++ b/logback-classic/performance/src/java/ch/qos/logback/classic/LoggerCreation.java @@ -1,11 +1,15 @@ /** - * LOGBack: the reliable, fast and flexible logging library for Java. + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2024, QOS.ch. All rights reserved. * - * Copyright (C) 1999-2005, QOS.ch, LOGBack.com + * 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 * - * This library is free software, you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software 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; diff --git a/logback-classic/performance/src/java/ch/qos/logback/classic/LoggerEventCreationTest.java b/logback-classic/performance/src/java/ch/qos/logback/classic/LoggerEventCreationTest.java index 43e3c216cf..3310e18568 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/classic/LoggerEventCreationTest.java +++ b/logback-classic/performance/src/java/ch/qos/logback/classic/LoggerEventCreationTest.java @@ -1,3 +1,16 @@ +/** + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, 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; import org.slf4j.LoggerFactory; diff --git a/logback-classic/performance/src/java/ch/qos/logback/classic/RetreivalOfExistingLoggerSpeed.java b/logback-classic/performance/src/java/ch/qos/logback/classic/RetreivalOfExistingLoggerSpeed.java index 01dbab7228..8cd52e5fc8 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/classic/RetreivalOfExistingLoggerSpeed.java +++ b/logback-classic/performance/src/java/ch/qos/logback/classic/RetreivalOfExistingLoggerSpeed.java @@ -1,11 +1,15 @@ /** - * LOGBack: the reliable, fast and flexible logging library for Java. + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * - * Copyright (C) 1999-2005, QOS.ch, LOGBack.com + * 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 * - * This library is free software, you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software 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; diff --git a/logback-classic/performance/src/java/ch/qos/logback/classic/SpeedOfDisabledDebug.java b/logback-classic/performance/src/java/ch/qos/logback/classic/SpeedOfDisabledDebug.java index 2ed5912afd..70c40a3fbf 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/classic/SpeedOfDisabledDebug.java +++ b/logback-classic/performance/src/java/ch/qos/logback/classic/SpeedOfDisabledDebug.java @@ -1,11 +1,15 @@ /** - * LOGBack: the reliable, fast and flexible logging library for Java. + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * - * Copyright (C) 1999-2005, QOS.ch, LOGBack.com + * 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 * - * This library is free software, you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software 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; diff --git a/logback-classic/performance/src/java/ch/qos/logback/classic/pattern/ClassNameAbbreviatorSpeed.java b/logback-classic/performance/src/java/ch/qos/logback/classic/pattern/ClassNameAbbreviatorSpeed.java index de11a38b4a..7e27f892cf 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/classic/pattern/ClassNameAbbreviatorSpeed.java +++ b/logback-classic/performance/src/java/ch/qos/logback/classic/pattern/ClassNameAbbreviatorSpeed.java @@ -1,11 +1,15 @@ /** - * LOGBack: the reliable, fast and flexible logging library for Java. + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * - * Copyright (C) 1999-2006, QOS.ch + * 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 * - * This library is free software, you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software 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.pattern; diff --git a/logback-classic/performance/src/java/ch/qos/logback/classic/pattern/WriteSpeed.java b/logback-classic/performance/src/java/ch/qos/logback/classic/pattern/WriteSpeed.java index fbede5e6f9..6fb594bbe3 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/classic/pattern/WriteSpeed.java +++ b/logback-classic/performance/src/java/ch/qos/logback/classic/pattern/WriteSpeed.java @@ -1,11 +1,15 @@ /** - * LOGBack: the reliable, fast and flexible logging library for Java. + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, QOS.ch. All rights reserved. * - * Copyright (C) 1999-2005, QOS.ch, LOGBack.com + * 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 * - * This library is free software, you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software 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.pattern; diff --git a/logback-classic/performance/src/java/ch/qos/logback/reflect/Fruit.java b/logback-classic/performance/src/java/ch/qos/logback/reflect/Fruit.java index 13ccca01e7..cc13ec40b0 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/reflect/Fruit.java +++ b/logback-classic/performance/src/java/ch/qos/logback/reflect/Fruit.java @@ -1,3 +1,16 @@ +/** + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, 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.reflect; public class Fruit { diff --git a/logback-classic/performance/src/java/ch/qos/logback/reflect/JEXLTest.java b/logback-classic/performance/src/java/ch/qos/logback/reflect/JEXLTest.java index 53102e4cfe..d6d7f0d798 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/reflect/JEXLTest.java +++ b/logback-classic/performance/src/java/ch/qos/logback/reflect/JEXLTest.java @@ -1,3 +1,16 @@ +/** + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, 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.reflect; import org.apache.commons.jexl.Expression; diff --git a/logback-classic/performance/src/java/ch/qos/logback/reflect/JaninoTest.java b/logback-classic/performance/src/java/ch/qos/logback/reflect/JaninoTest.java index 63ed41451a..510e3d7714 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/reflect/JaninoTest.java +++ b/logback-classic/performance/src/java/ch/qos/logback/reflect/JaninoTest.java @@ -1,3 +1,16 @@ +/** + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, 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.reflect; import org.codehaus.janino.ExpressionEvaluator; diff --git a/logback-classic/performance/src/java/ch/qos/logback/reflect/ReflectionSpeed.java b/logback-classic/performance/src/java/ch/qos/logback/reflect/ReflectionSpeed.java index 81f6c6af8f..adc3cfc166 100644 --- a/logback-classic/performance/src/java/ch/qos/logback/reflect/ReflectionSpeed.java +++ b/logback-classic/performance/src/java/ch/qos/logback/reflect/ReflectionSpeed.java @@ -1,3 +1,16 @@ +/** + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2022, 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.reflect; import java.lang.reflect.InvocationTargetException; diff --git a/logback-core/src/test/input/compress3.copy b/logback-core/src/test/input/compress3.copy index 87087da0cc..885e4175d1 100644 --- a/logback-core/src/test/input/compress3.copy +++ b/logback-core/src/test/input/compress3.copy @@ -1,11 +1,3 @@ - - LOGBack: the generic, reliable, fast and flexible logging framework. - - Copyright (C) 1999-2006, QOS.ch - - This library is free software, you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free - Software Foundation. From 1c749f734d577dddd3669447132460eb70d08e97 Mon Sep 17 00:00:00 2001 From: xuwenping Date: Fri, 19 Jan 2024 21:52:36 +0800 Subject: [PATCH 2/3] fix unit test failed Signed-off-by: xuwenping --- .../ch/qos/logback/access/pattern/DateConverter.java | 11 +++++++++-- .../ch/qos/logback/access/pattern/ConverterTest.java | 2 +- .../TimeBasedRollingWithArchiveRemoval_Test.java | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java index 158619f74d..754a9cdd7d 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java +++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java @@ -15,6 +15,7 @@ import java.time.ZoneId; import java.util.List; +import java.util.Locale; import ch.qos.logback.access.spi.IAccessEvent; import ch.qos.logback.core.CoreConstants; @@ -44,13 +45,19 @@ public void start() { zoneId = ZoneId.of(zoneIdString); } + Locale locale = null; + if (optionList != null && optionList.size() > 2) { + String localeIdStr = optionList.get(2); + locale = Locale.forLanguageTag(localeIdStr); + } + try { - cachingDateFormatter = new CachingDateFormatter(datePattern, zoneId); + cachingDateFormatter = new CachingDateFormatter(datePattern, zoneId, locale); // maximumCacheValidity = CachedDateFormat.getMaximumCacheValidity(pattern); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e); addWarn("Defaulting to " + CoreConstants.CLF_DATE_PATTERN); - cachingDateFormatter = new CachingDateFormatter(CoreConstants.CLF_DATE_PATTERN, zoneId); + cachingDateFormatter = new CachingDateFormatter(CoreConstants.CLF_DATE_PATTERN, zoneId, locale); } } diff --git a/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java b/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java index 07a4875f73..c5de1214d7 100644 --- a/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java +++ b/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java @@ -76,7 +76,7 @@ public void testDateConverter() { @Test public void testDateConverter_AU_locale() { DateConverter converter = new DateConverter(); - List optionsList = Lists.list(CoreConstants.CLF_DATE_PATTERN, "Australia/Sydney", "en-AU"); + List optionsList = Lists.list(CoreConstants.CLF_DATE_PATTERN, "Australia/Sydney", "en_AU"); converter.setOptionList(optionsList); converter.start(); diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_Test.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_Test.java index 00a1199190..a049a6f90d 100755 --- a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_Test.java +++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_Test.java @@ -291,7 +291,7 @@ public void dailySizeBasedRolloverWithSizeCap() { // 2016-03-05 00:14:39 CET long simulatedTime = 1457133279186L; ConfigParameters params = new ConfigParameters(simulatedTime); - String fileNamePattern = randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}-clean.%i"; + String fileNamePattern = randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + ", CET}-clean.%i"; params.maxHistory(60).fileNamePattern(fileNamePattern).simulatedNumberOfPeriods(10).sizeCap(sizeCap); logOverMultiplePeriods(params); From af751f60558b8b9fc31c3d23d18f5462c84b6b05 Mon Sep 17 00:00:00 2001 From: xuwenping Date: Fri, 19 Jan 2024 22:00:01 +0800 Subject: [PATCH 3/3] fix unit test failed Signed-off-by: xuwenping --- .../main/java/ch/qos/logback/access/pattern/DateConverter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java index 754a9cdd7d..539c1f5135 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java +++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java @@ -53,7 +53,6 @@ public void start() { try { cachingDateFormatter = new CachingDateFormatter(datePattern, zoneId, locale); - // maximumCacheValidity = CachedDateFormat.getMaximumCacheValidity(pattern); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e); addWarn("Defaulting to " + CoreConstants.CLF_DATE_PATTERN);