From d44d187501d9e2f8cfe0ac4a7f88663ccf70d503 Mon Sep 17 00:00:00 2001 From: yangjuanying <531948963@qq.com> Date: Tue, 29 Aug 2023 16:39:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9license=E3=80=81=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E6=94=B9=E6=88=90=E8=8B=B1=E6=96=87=E3=80=81=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++- .../PolarisConfigCustomExtensionLayer.java | 20 ++++++++++----- .../adapter/PolarisConfigFileLocator.java | 2 +- .../PolarisConfigPropertyAutoRefresher.java | 4 +-- .../adapter/PolarisServiceLoaderUtil.java | 25 +++++++++++++------ ...arisConfigRefreshOptimizationListener.java | 2 +- .../cloud/polaris/config/logger/Level.java | 2 +- .../logger/PolarisConfigLoggerContext.java | 23 +++++++++++------ 8 files changed, 54 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 984643edf..3753c5106 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,4 +25,5 @@ - feat:added ribbon lb polaris weighted round robin rule. - fix:fix feign report -1 port bug. - fix:upgrade spring version. -- fix:Update README-zh.md \ No newline at end of file +- fix:Update README-zh.md +- feature: support Polaris configuration center extension plugin interface and support dynamic modification of log levels. \ No newline at end of file diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigCustomExtensionLayer.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigCustomExtensionLayer.java index 8e907ad61..2549f0773 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigCustomExtensionLayer.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigCustomExtensionLayer.java @@ -1,10 +1,18 @@ /* - * Copyright (c) 2023 www.tencent.com. - * All Rights Reserved. - * This program is the confidential and proprietary information of - * www.tencent.com ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with - * the terms of the license agreement you entered into with www.tencent.com. + * Tencent is pleased to support the open source community by making Spring Cloud Tencent available. + * + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * + * Licensed under the BSD 3-Clause License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/BSD-3-Clause + * + * 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. * */ diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java index c888c9ce0..634807a1b 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java @@ -68,7 +68,7 @@ public class PolarisConfigFileLocator implements PropertySourceLocator { private final PolarisPropertySourceManager polarisPropertySourceManager; private final Environment environment; - // 此类给一些客户定制化逻辑做一些特殊业务分组文件的配置处理 + // this class provides customized logic for some customers to configure special business group files private final PolarisConfigCustomExtensionLayer polarisConfigCustomExtensionLayer = PolarisServiceLoaderUtil.getPolarisConfigCustomExtensionLayer(); public PolarisConfigFileLocator(PolarisConfigProperties polarisConfigProperties, PolarisContextProperties polarisContextProperties, ConfigFileService configFileService, PolarisPropertySourceManager polarisPropertySourceManager, Environment environment) { diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigPropertyAutoRefresher.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigPropertyAutoRefresher.java index 78362dfaf..904b87090 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigPropertyAutoRefresher.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigPropertyAutoRefresher.java @@ -50,7 +50,7 @@ public abstract class PolarisConfigPropertyAutoRefresher implements ApplicationL private final AtomicBoolean registered = new AtomicBoolean(false); - // 此类给一些客户定制化逻辑做一些特殊业务分组文件的配置处理 + // this class provides customized logic for some customers to configure special business group files private final PolarisConfigCustomExtensionLayer polarisConfigCustomExtensionLayer = PolarisServiceLoaderUtil.getPolarisConfigCustomExtensionLayer(); public PolarisConfigPropertyAutoRefresher(PolarisConfigProperties polarisConfigProperties, PolarisPropertySourceManager polarisPropertySourceManager) { @@ -108,7 +108,7 @@ public abstract class PolarisConfigPropertyAutoRefresher implements ApplicationL LOGGER.info("[SCT Config] changed property = {}", configPropertyChangeInfo); - // 新增动态改变日志级别的能力 + // new ability to dynamically change log levels try { if (changedKey.startsWith("logging.level") && changedKey.length() >= 14) { String loggerName = changedKey.substring(14); diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisServiceLoaderUtil.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisServiceLoaderUtil.java index 8ee4e8b13..343a5b319 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisServiceLoaderUtil.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisServiceLoaderUtil.java @@ -1,10 +1,19 @@ /* - * Copyright (c) 2023 www.tencent.com. - * All Rights Reserved. - * This program is the confidential and proprietary information of - * www.tencent.com ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with - * the terms of the license agreement you entered into with www.tencent.com. + * Tencent is pleased to support the open source community by making Spring Cloud Tencent available. + * + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * + * Licensed under the BSD 3-Clause License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/BSD-3-Clause + * + * 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 com.tencent.cloud.polaris.config.adapter; @@ -23,12 +32,12 @@ public final class PolarisServiceLoaderUtil { private static final Logger LOGGER = LoggerFactory.getLogger(PolarisServiceLoaderUtil.class); private PolarisServiceLoaderUtil() { } - // 此类给一些客户定制化逻辑做一些特殊业务分组文件的配置处理 + // this class provides customized logic for some customers to configure special business group files private static PolarisConfigCustomExtensionLayer polarisConfigCustomExtensionLayer; static { ServiceLoader polarisConfigCustomExtensionLayerLoader = ServiceLoader.load(PolarisConfigCustomExtensionLayer.class); Iterator polarisConfigCustomExtensionLayerIterator = polarisConfigCustomExtensionLayerLoader.iterator(); - // 一般就一个实现类,如果有多个,那么加载的是最后一个 + // Generally, there is only one implementation class. If there are multiple, the last one is loaded while (polarisConfigCustomExtensionLayerIterator.hasNext()) { polarisConfigCustomExtensionLayer = polarisConfigCustomExtensionLayerIterator.next(); LOGGER.info("[SCT Config] PolarisConfigFileLocator init polarisConfigCustomExtensionLayer:{}", polarisConfigCustomExtensionLayer); diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigRefreshOptimizationListener.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigRefreshOptimizationListener.java index 487bcd27d..54f0c6246 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigRefreshOptimizationListener.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigRefreshOptimizationListener.java @@ -112,7 +112,7 @@ public class PolarisConfigRefreshOptimizationListener implements ApplicationList beanFactory.removeBeanDefinition(REFLECT_REBINDER_BEAN_NAME); } catch (BeansException e) { - // 如果这段代码出现removeBean异常不要影响主进程启动,有些用户用法会导致polarisReflectPropertySourceAutoRefresher没加载,这时候removeBeanDefinition会报错 + // If there is a removeBean exception in this code, do not affect the main process startup. Some user usage may cause the polarisReflectPropertySourceAutoRefresher to not load, and the removeBeanDefinition will report an error LOGGER.debug("removeRelatedBeansOfReflect occur error:", e); } } diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/logger/Level.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/logger/Level.java index 17babf0a7..29dfc0ab6 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/logger/Level.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/logger/Level.java @@ -5,7 +5,7 @@ package com.tencent.cloud.polaris.config.logger; */ public enum Level { - /** 日志级别. */ + /** log level. */ TRACE("TRACE"), DEBUG("DEBUG"), INFO("INFO"), WARN("WARN"), ERROR("ERROR"), FATAL("FATAL"), OFF("OFF"); private String level; diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/logger/PolarisConfigLoggerContext.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/logger/PolarisConfigLoggerContext.java index 9bda215f8..29865835a 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/logger/PolarisConfigLoggerContext.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/logger/PolarisConfigLoggerContext.java @@ -1,10 +1,19 @@ /* - * Copyright (c) 2018 www.tencent.com. - * All Rights Reserved. - * This program is the confidential and proprietary information of - * www.tencent.com ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with - * the terms of the license agreement you entered into with www.tencent.com. + * Tencent is pleased to support the open source community by making Spring Cloud Tencent available. + * + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * + * Licensed under the BSD 3-Clause License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/BSD-3-Clause + * + * 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 com.tencent.cloud.polaris.config.logger; @@ -73,7 +82,7 @@ public final class PolarisConfigLoggerContext { printLog("[SCT Config] PolarisConfigLoggerContext logger: [" + loggerName + "] changed to level:" + level, Level.INFO); } /** - * 打印日志. + * print log. */ private static void printLog(String message, Level level) { Logger logger = LoggerFactory.getLogger(ROOT_LOGGER_NAME);