This is an automated email from the ASF dual-hosted git repository.
sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 303869781fa Use Slf4's Level instead of LoggerLevel (#28559)
303869781fa is described below
commit 303869781fa84c3af4afd0138b82925e2fccacd7
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Sep 23 22:10:36 2023 +0800
Use Slf4's Level instead of LoggerLevel (#28559)
---
.../config/props/ConfigurationPropertyKey.java | 3 ++-
.../infra/config/props/LoggerLevel.java | 26 ----------------------
.../config/props/ConfigurationPropertiesTest.java | 7 +++---
.../ral/updatable/SetDistVariableUpdaterTest.java | 4 ++--
4 files changed, 8 insertions(+), 32 deletions(-)
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
index e2fcfca5688..b731cd9a2f8 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
@@ -21,6 +21,7 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.props.TypedPropertyKey;
+import org.slf4j.event.Level;
import java.util.Arrays;
import java.util.Collection;
@@ -36,7 +37,7 @@ public enum ConfigurationPropertyKey implements
TypedPropertyKey {
/**
* The system log level.
*/
- SYSTEM_LOG_LEVEL("system-log-level", LoggerLevel.INFO.name(),
LoggerLevel.class, false),
+ SYSTEM_LOG_LEVEL("system-log-level", Level.INFO.toString(), Level.class,
false),
/**
* Whether show SQL in log.
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/LoggerLevel.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/LoggerLevel.java
deleted file mode 100644
index 48e75730377..00000000000
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/props/LoggerLevel.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.config.props;
-
-/**
- * Logger level.
- */
-public enum LoggerLevel {
-
- DEBUG, INFO, WARN, ERROR
-}
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
index 4e6b43621f9..3b88daf8adc 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
@@ -22,6 +22,7 @@ import
org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
+import org.slf4j.event.Level;
import java.util.Properties;
@@ -36,7 +37,7 @@ class ConfigurationPropertiesTest {
@Test
void assertGetValue() {
ConfigurationProperties actual = new
ConfigurationProperties(createProperties());
- assertThat(actual.getValue(ConfigurationPropertyKey.SYSTEM_LOG_LEVEL),
is(LoggerLevel.DEBUG));
+ assertThat(actual.getValue(ConfigurationPropertyKey.SYSTEM_LOG_LEVEL),
is(Level.DEBUG));
assertTrue((Boolean)
actual.getValue(ConfigurationPropertyKey.SQL_SHOW));
assertTrue((Boolean)
actual.getValue(ConfigurationPropertyKey.SQL_SIMPLE));
assertThat(actual.getValue(ConfigurationPropertyKey.KERNEL_EXECUTOR_SIZE),
is(20));
@@ -54,7 +55,7 @@ class ConfigurationPropertiesTest {
private Properties createProperties() {
return PropertiesBuilder.build(
- new
Property(ConfigurationPropertyKey.SYSTEM_LOG_LEVEL.getKey(),
LoggerLevel.DEBUG.toString()),
+ new
Property(ConfigurationPropertyKey.SYSTEM_LOG_LEVEL.getKey(),
Level.DEBUG.toString()),
new Property(ConfigurationPropertyKey.SQL_SHOW.getKey(),
Boolean.TRUE.toString()),
new Property(ConfigurationPropertyKey.SQL_SIMPLE.getKey(),
Boolean.TRUE.toString()),
new
Property(ConfigurationPropertyKey.KERNEL_EXECUTOR_SIZE.getKey(), "20"),
@@ -73,7 +74,7 @@ class ConfigurationPropertiesTest {
@Test
void assertGetDefaultValue() {
ConfigurationProperties actual = new ConfigurationProperties(new
Properties());
- assertThat(actual.getValue(ConfigurationPropertyKey.SYSTEM_LOG_LEVEL),
is(LoggerLevel.INFO));
+ assertThat(actual.getValue(ConfigurationPropertyKey.SYSTEM_LOG_LEVEL),
is(Level.INFO));
assertFalse((Boolean)
actual.getValue(ConfigurationPropertyKey.SQL_SHOW));
assertFalse((Boolean)
actual.getValue(ConfigurationPropertyKey.SQL_SIMPLE));
assertThat(actual.getValue(ConfigurationPropertyKey.KERNEL_EXECUTOR_SIZE),
is(0));
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java
index e2c17c92dab..1fb53f570b5 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java
@@ -20,7 +20,6 @@ package
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;
import
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.SetDistVariableStatement;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
-import org.apache.shardingsphere.infra.config.props.LoggerLevel;
import
org.apache.shardingsphere.infra.config.props.temporary.TemporaryConfigurationPropertyKey;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
import org.apache.shardingsphere.infra.instance.InstanceContext;
@@ -41,6 +40,7 @@ import org.apache.shardingsphere.test.mock.StaticMockSettings;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
+import org.slf4j.event.Level;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -88,7 +88,7 @@ class SetDistVariableUpdaterTest {
updater.executeUpdate(connectionSession, statement);
Object actualValue =
contextManager.getMetaDataContexts().getMetaData().getProps().getProps().get("system-log-level");
assertThat(actualValue.toString(), is("DEBUG"));
-
assertThat(contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.SYSTEM_LOG_LEVEL),
is(LoggerLevel.DEBUG));
+
assertThat(contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.SYSTEM_LOG_LEVEL),
is(Level.DEBUG));
}
@Test