You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/02/02 01:54:28 UTC
[shardingsphere] branch master updated: refactor log output in agent core (#23905)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 8242dfc717c refactor log output in agent core (#23905)
8242dfc717c is described below
commit 8242dfc717c77d3dd02bff6ea24a182e81327820
Author: jiangML <10...@qq.com>
AuthorDate: Thu Feb 2 09:54:18 2023 +0800
refactor log output in agent core (#23905)
---
agent/core/pom.xml | 41 +++++------
.../advisor/config/AdvisorConfigurationLoader.java | 2 +-
.../executor/type/ConstructorAdviceExecutor.java | 2 +-
.../type/InstanceMethodAdviceExecutor.java | 2 +-
.../executor/type/StaticMethodAdviceExecutor.java | 2 +-
.../agent/core/builder/AgentBuilderFactory.java | 3 +-
.../agent/core/builder/AgentLoggingListener.java | 56 ---------------
.../impl/MethodAdvisorBuilderInterceptor.java | 2 +-
.../agent/core/log}/AgentLogger.java | 17 +----
.../agent/core/log/AgentLoggerClassLoader.java | 39 ----------
.../core/log/AgentLoggerClassLoaderFactory.java | 78 --------------------
.../agent/core/log/AgentLoggerFactory.java | 26 ++-----
.../core/log/config/LogbackConfiguration.java | 84 ++++++++++++++++++++++
.../agent/core}/log/slf4j/SLF4JAgentLogger.java | 14 +---
.../core/plugin/PluginLifecycleServiceManager.java | 8 +--
.../agent/core/plugin/jar/PluginJarLoader.java | 2 +-
.../agent/core/spi/AgentServiceLoader.java | 23 ++----
.../ch.qos.logback.classic.spi.Configurator} | 2 +-
agent/log/log-api/pom.xml | 47 ------------
.../agent/log/api/impl/NOPAgentLogger.java | 56 ---------------
.../agent/log/spi/AgentLoggerFactorySPI.java | 42 -----------
agent/log/log-to-slf4j/pom.xml | 44 ------------
.../agent/log/slf4j/SLF4JAgentLoggerFactory.java | 43 -----------
agent/log/pom.xml | 35 ---------
agent/pom.xml | 1 -
distribution/agent/pom.xml | 11 ---
.../shardingsphere-agent-binary-distribution.xml | 11 ---
.../test/resources/docker/agent/conf/logback.xml | 30 --------
.../test/resources/docker/agent/conf/logback.xml | 30 --------
.../test/resources/docker/agent/conf/logback.xml | 30 --------
.../test/resources/docker/agent/conf/logback.xml | 30 --------
31 files changed, 126 insertions(+), 687 deletions(-)
diff --git a/agent/core/pom.xml b/agent/core/pom.xml
index f21c35c4f88..f0ea8947bcd 100644
--- a/agent/core/pom.xml
+++ b/agent/core/pom.xml
@@ -37,11 +37,6 @@
<artifactId>shardingsphere-agent-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-agent-log-api</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
@@ -51,27 +46,10 @@
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jul-to-slf4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-agent-log-to-slf4j</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>compile</scope>
</dependency>
</dependencies>
@@ -96,6 +74,7 @@
<Can-Retransform-Classes>true</Can-Retransform-Classes>
</manifestEntries>
</transformer>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
<relocations>
<relocation>
@@ -110,6 +89,18 @@
<pattern>org.yaml</pattern>
<shadedPattern>${shade.package}.org.yaml</shadedPattern>
</relocation>
+ <relocation>
+ <pattern>org.slf4j</pattern>
+ <shadedPattern>${shade.package}.org.slf4j</shadedPattern>
+ </relocation>
+ <relocation>
+ <pattern>ch.qos.logback</pattern>
+ <shadedPattern>${shade.package}.ch.qos.logback</shadedPattern>
+ </relocation>
+ <relocation>
+ <pattern>org.apache.commons.logging</pattern>
+ <shadedPattern>${shade.package}.org.apache.commons.logging</shadedPattern>
+ </relocation>
</relocations>
</configuration>
</execution>
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/config/AdvisorConfigurationLoader.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/config/AdvisorConfigurationLoader.java
index 125fb5eb7ca..d5f30088ea4 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/config/AdvisorConfigurationLoader.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/config/AdvisorConfigurationLoader.java
@@ -21,10 +21,10 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.agent.core.advisor.config.yaml.loader.YamlAdvisorsConfigurationLoader;
import org.apache.shardingsphere.agent.core.advisor.config.yaml.swapper.YamlAdvisorsConfigurationSwapper;
+import org.apache.shardingsphere.agent.core.log.AgentLogger;
import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory;
import org.apache.shardingsphere.agent.core.plugin.classloader.AgentPluginClassLoader;
import org.apache.shardingsphere.agent.core.plugin.jar.PluginJarLoader;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
import java.io.InputStream;
import java.util.Collection;
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java
index f25eaf0e2ca..4bf33d8f374 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java
@@ -29,9 +29,9 @@ import net.bytebuddy.matcher.ElementMatchers;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.ConstructorAdvice;
import org.apache.shardingsphere.agent.core.advisor.executor.AdviceExecutor;
+import org.apache.shardingsphere.agent.core.log.AgentLogger;
import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory;
import org.apache.shardingsphere.agent.core.plugin.PluginContext;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
import java.util.Collection;
import java.util.Map;
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/InstanceMethodAdviceExecutor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/InstanceMethodAdviceExecutor.java
index 20a793af70a..699049e37fb 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/InstanceMethodAdviceExecutor.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/InstanceMethodAdviceExecutor.java
@@ -31,9 +31,9 @@ import net.bytebuddy.matcher.ElementMatchers;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
import org.apache.shardingsphere.agent.core.advisor.executor.AdviceExecutor;
+import org.apache.shardingsphere.agent.core.log.AgentLogger;
import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory;
import org.apache.shardingsphere.agent.core.plugin.PluginContext;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
import java.lang.reflect.Method;
import java.util.Collection;
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/StaticMethodAdviceExecutor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/StaticMethodAdviceExecutor.java
index a802a88ca02..b66cc9d3498 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/StaticMethodAdviceExecutor.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/StaticMethodAdviceExecutor.java
@@ -29,9 +29,9 @@ import net.bytebuddy.implementation.bind.annotation.SuperCall;
import net.bytebuddy.matcher.ElementMatchers;
import org.apache.shardingsphere.agent.api.advice.type.StaticMethodAdvice;
import org.apache.shardingsphere.agent.core.advisor.executor.AdviceExecutor;
+import org.apache.shardingsphere.agent.core.log.AgentLogger;
import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory;
import org.apache.shardingsphere.agent.core.plugin.PluginContext;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
import java.lang.reflect.Method;
import java.util.Collection;
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactory.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactory.java
index e1444054bb3..6633a9a4555 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactory.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactory.java
@@ -53,7 +53,6 @@ public final class AgentBuilderFactory {
.or(ElementMatchers.nameStartsWith("org.apache.shardingsphere.agent."))
.type(new AgentJunction(advisorConfigs))
.transform(new AgentTransformer(pluginConfigs, pluginJars, advisorConfigs, isEnhancedForProxy))
- .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
- .with(new AgentLoggingListener());
+ .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION);
}
}
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentLoggingListener.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentLoggingListener.java
deleted file mode 100644
index 270eb28f6f4..00000000000
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentLoggingListener.java
+++ /dev/null
@@ -1,56 +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.agent.core.builder;
-
-import net.bytebuddy.agent.builder.AgentBuilder.Listener;
-import net.bytebuddy.description.type.TypeDescription;
-import net.bytebuddy.dynamic.DynamicType;
-import net.bytebuddy.utility.JavaModule;
-import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
-
-/**
- * Agent logging listener.
- */
-@SuppressWarnings("NullableProblems")
-public final class AgentLoggingListener implements Listener {
-
- private static final AgentLogger LOGGER = AgentLoggerFactory.getAgentLogger(AgentLoggingListener.class);
-
- @Override
- public void onDiscovery(final String typeName, final ClassLoader classLoader, final JavaModule module, final boolean loaded) {
- }
-
- @Override
- public void onTransformation(final TypeDescription typeDescription, final ClassLoader classLoader, final JavaModule module, final boolean loaded, final DynamicType dynamicType) {
- LOGGER.debug("On transformation class {}.", typeDescription.getTypeName());
- }
-
- @Override
- public void onIgnored(final TypeDescription typeDescription, final ClassLoader classLoader, final JavaModule module, final boolean loaded) {
- }
-
- @Override
- public void onError(final String typeName, final ClassLoader classLoader, final JavaModule module, final boolean loaded, final Throwable throwable) {
- LOGGER.error("Failed to instrument {}.", typeName, throwable);
- }
-
- @Override
- public void onComplete(final String typeName, final ClassLoader classLoader, final JavaModule module, final boolean loaded) {
- }
-}
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/interceptor/impl/MethodAdvisorBuilderInterceptor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/interceptor/impl/MethodAdvisorBuilderInterceptor.java
index ab8d82f6fc8..9a9bc31806d 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/interceptor/impl/MethodAdvisorBuilderInterceptor.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/interceptor/impl/MethodAdvisorBuilderInterceptor.java
@@ -25,8 +25,8 @@ import org.apache.shardingsphere.agent.core.advisor.executor.AdviceExecutor;
import org.apache.shardingsphere.agent.core.advisor.executor.AdviceExecutorFactory;
import org.apache.shardingsphere.agent.core.builder.interceptor.AgentBuilderInterceptor;
import org.apache.shardingsphere.agent.core.classloader.ClassLoaderContext;
+import org.apache.shardingsphere.agent.core.log.AgentLogger;
import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
import java.util.Optional;
diff --git a/agent/log/log-api/src/main/java/org/apache/shardingsphere/agent/log/api/AgentLogger.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLogger.java
similarity index 81%
rename from agent/log/log-api/src/main/java/org/apache/shardingsphere/agent/log/api/AgentLogger.java
rename to agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLogger.java
index 904ea6f5eb4..4f69ca1b3a5 100644
--- a/agent/log/log-api/src/main/java/org/apache/shardingsphere/agent/log/api/AgentLogger.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLogger.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.agent.log.api;
+package org.apache.shardingsphere.agent.core.log;
/**
* Agent logger.
@@ -51,19 +51,4 @@ public interface AgentLogger {
* @param msg message
*/
void error(String msg);
-
- /**
- * Debug.
- *
- * @param format format
- * @param arguments arguments
- */
- void debug(String format, Object... arguments);
-
- /**
- * Debug.
- *
- * @param msg message
- */
- void debug(String msg);
}
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerClassLoader.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerClassLoader.java
deleted file mode 100644
index b7c45746254..00000000000
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerClassLoader.java
+++ /dev/null
@@ -1,39 +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.agent.core.log;
-
-import org.apache.shardingsphere.agent.core.classloader.AgentExtraClassLoader;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.jar.JarFile;
-
-/**
- * Agent logger class loader.
- */
-public final class AgentLoggerClassLoader extends AgentExtraClassLoader {
-
- public AgentLoggerClassLoader(final Collection<JarFile> loggingJars, final File resourcePath) {
- super(AgentLoggerFactory.class.getClassLoader(), loggingJars, Collections.singleton(resourcePath));
- }
-
- public AgentLoggerClassLoader() {
- super(AgentLoggerFactory.class.getClassLoader(), Collections.emptyList());
- }
-}
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerClassLoaderFactory.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerClassLoaderFactory.java
deleted file mode 100644
index 91e584f9600..00000000000
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerClassLoaderFactory.java
+++ /dev/null
@@ -1,78 +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.agent.core.log;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import lombok.SneakyThrows;
-import org.apache.shardingsphere.agent.core.path.AgentPath;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.jar.JarFile;
-
-/**
- * Agent logger class loader factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class AgentLoggerClassLoaderFactory {
-
- /**
- * Create agent logger class loader.
- *
- * @return agent logger class loader
- */
- @SneakyThrows(URISyntaxException.class)
- public static AgentLoggerClassLoader create() {
- File agentFle = new File(AgentLoggerFactory.class.getProtectionDomain().getCodeSource().getLocation().toURI());
- return agentFle.isFile() && agentFle.getName().endsWith(".jar") ? new AgentLoggerClassLoader(getLoggingJars(), getLoggingResourcePath()) : new AgentLoggerClassLoader();
- }
-
- @SneakyThrows(IOException.class)
- private static Collection<JarFile> getLoggingJars() {
- Collection<JarFile> result = new LinkedList<>();
- Files.walkFileTree(new File(String.join(File.separator, AgentPath.getRootPath().getPath(), "log-lib")).toPath(), new SimpleFileVisitor<Path>() {
-
- @Override
- public FileVisitResult visitFile(final Path path, final BasicFileAttributes attributes) {
- if (path.toFile().isFile() && path.toFile().getName().endsWith(".jar")) {
- result.add(getJarFile(path));
- }
- return FileVisitResult.CONTINUE;
- }
- });
- return result;
- }
-
- @SneakyThrows(IOException.class)
- private static JarFile getJarFile(final Path path) {
- return new JarFile(path.toFile(), true);
- }
-
- private static File getLoggingResourcePath() {
- return new File(String.join(File.separator, AgentPath.getRootPath().getPath(), "conf"));
- }
-}
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerFactory.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerFactory.java
index ebb41a965d4..b80206195d0 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerFactory.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerFactory.java
@@ -19,12 +19,11 @@ package org.apache.shardingsphere.agent.core.log;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.agent.core.spi.AgentServiceLoader;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
-import org.apache.shardingsphere.agent.log.api.impl.NOPAgentLogger;
-import org.apache.shardingsphere.agent.log.spi.AgentLoggerFactorySPI;
+import org.apache.shardingsphere.agent.core.log.slf4j.SLF4JAgentLogger;
+import org.slf4j.LoggerFactory;
-import java.util.Optional;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Agent logger factory.
@@ -32,7 +31,7 @@ import java.util.Optional;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class AgentLoggerFactory {
- private static AgentLoggerClassLoader agentLoggerClassLoader;
+ private static final Map<String, AgentLogger> LOGGERS = new ConcurrentHashMap<>();
/**
* Get agent logger.
@@ -51,19 +50,6 @@ public final class AgentLoggerFactory {
* @return agent logger
*/
public static AgentLogger getAgentLogger(final String name) {
- Optional<AgentLoggerFactorySPI> loggerFactory = AgentServiceLoader.getServiceLoader(getAgentLoggerClassLoader(), AgentLoggerFactorySPI.class).getServices().stream().findFirst();
- return loggerFactory.isPresent() ? loggerFactory.get().getAgentLogger(name) : new NOPAgentLogger();
- }
-
- private static AgentLoggerClassLoader getAgentLoggerClassLoader() {
- if (null != agentLoggerClassLoader) {
- return agentLoggerClassLoader;
- }
- synchronized (AgentLoggerFactory.class) {
- if (null == agentLoggerClassLoader) {
- agentLoggerClassLoader = AgentLoggerClassLoaderFactory.create();
- }
- }
- return agentLoggerClassLoader;
+ return LOGGERS.computeIfAbsent(name, key -> new SLF4JAgentLogger(LoggerFactory.getLogger(name)));
}
}
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/config/LogbackConfiguration.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/config/LogbackConfiguration.java
new file mode 100644
index 00000000000..7f1e09713aa
--- /dev/null
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/config/LogbackConfiguration.java
@@ -0,0 +1,84 @@
+/*
+ * 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.agent.core.log.config;
+
+import ch.qos.logback.classic.BasicConfigurator;
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.PatternLayout;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.FileAppender;
+import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
+import org.apache.shardingsphere.agent.core.path.AgentPath;
+
+import java.io.File;
+
+/**
+ * Logback configuration.
+ */
+public final class LogbackConfiguration extends BasicConfigurator {
+
+ public static final String DEFAULT_PATTERN = "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n";
+
+ public static final String SHARDINGSPHERE_LOGGER_NAME = "org.apache.shardingsphere.agent";
+
+ @Override
+ public void configure(final LoggerContext loggerContext) {
+ Appender<ILoggingEvent> appender = createFileAppender(loggerContext);
+ Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
+ rootLogger.setLevel(Level.INFO);
+ rootLogger.addAppender(appender);
+ Logger logger = loggerContext.getLogger(SHARDINGSPHERE_LOGGER_NAME);
+ logger.setLevel(Level.INFO);
+ logger.setAdditive(false);
+ logger.addAppender(appender);
+ }
+
+ private FileAppender<ILoggingEvent> createFileAppender(final LoggerContext loggerContext) {
+ FileAppender<ILoggingEvent> result = new FileAppender<>();
+ result.setContext(loggerContext);
+ result.setName("fileAppender");
+ result.setFile(getLogFile());
+ LayoutWrappingEncoder<ILoggingEvent> encoder = createEncoder(loggerContext);
+ result.setEncoder(encoder);
+ result.start();
+ return result;
+ }
+
+ private String getLogFile() {
+ return String.join(File.separator, AgentPath.getRootPath().getPath(), "log", "stdout.log");
+ }
+
+ private LayoutWrappingEncoder<ILoggingEvent> createEncoder(final LoggerContext loggerContext) {
+ LayoutWrappingEncoder<ILoggingEvent> result = new LayoutWrappingEncoder<>();
+ result.setContext(loggerContext);
+ PatternLayout layout = createPatternLayout(loggerContext);
+ result.setLayout(layout);
+ return result;
+ }
+
+ private PatternLayout createPatternLayout(final LoggerContext loggerContext) {
+ PatternLayout result = new PatternLayout();
+ result.setPattern(DEFAULT_PATTERN);
+ result.setContext(loggerContext);
+ result.start();
+ return result;
+ }
+}
diff --git a/agent/log/log-to-slf4j/src/main/java/org/apache/shardingsphere/agent/log/slf4j/SLF4JAgentLogger.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/slf4j/SLF4JAgentLogger.java
similarity index 81%
rename from agent/log/log-to-slf4j/src/main/java/org/apache/shardingsphere/agent/log/slf4j/SLF4JAgentLogger.java
rename to agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/slf4j/SLF4JAgentLogger.java
index dff68335005..656d23ff1ae 100644
--- a/agent/log/log-to-slf4j/src/main/java/org/apache/shardingsphere/agent/log/slf4j/SLF4JAgentLogger.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/slf4j/SLF4JAgentLogger.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.agent.log.slf4j;
+package org.apache.shardingsphere.agent.core.log.slf4j;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
+import org.apache.shardingsphere.agent.core.log.AgentLogger;
import org.slf4j.Logger;
/**
@@ -48,14 +48,4 @@ public final class SLF4JAgentLogger implements AgentLogger {
public void error(final String msg) {
logger.error(msg);
}
-
- @Override
- public void debug(final String format, final Object... arguments) {
- logger.debug(format, arguments);
- }
-
- @Override
- public void debug(final String msg) {
- logger.debug(msg);
- }
}
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java
index be3ec3ba020..2f492f0e6c0 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.agent.core.plugin;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.agent.api.PluginConfiguration;
+import org.apache.shardingsphere.agent.core.log.AgentLogger;
import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory;
import org.apache.shardingsphere.agent.core.spi.AgentServiceLoader;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
import org.apache.shardingsphere.agent.spi.PluginLifecycleService;
import java.io.IOException;
@@ -53,7 +53,7 @@ public final class PluginLifecycleServiceManager {
public static void init(final Map<String, PluginConfiguration> pluginConfigs, final Collection<JarFile> pluginJars, final ClassLoader pluginClassLoader, final boolean isEnhancedForProxy) {
if (STARTED_FLAG.compareAndSet(false, true)) {
PluginLifecycleServiceManager.start(pluginConfigs, pluginClassLoader, isEnhancedForProxy);
- Runtime.getRuntime().addShutdownHook(new Thread(() -> PluginLifecycleServiceManager.close(pluginClassLoader, pluginJars)));
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> PluginLifecycleServiceManager.close(pluginJars)));
}
}
@@ -81,8 +81,8 @@ public final class PluginLifecycleServiceManager {
}
}
- private static void close(final ClassLoader pluginClassLoader, final Collection<JarFile> pluginJars) {
- AgentServiceLoader.getServiceLoader(pluginClassLoader, PluginLifecycleService.class).getServices().forEach(each -> {
+ private static void close(final Collection<JarFile> pluginJars) {
+ AgentServiceLoader.getServiceLoader(PluginLifecycleService.class).getServices().forEach(each -> {
try {
each.close();
// CHECKSTYLE:OFF
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java
index b890cd7ed64..bb61a6a27c3 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.agent.core.plugin.jar;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
+import org.apache.shardingsphere.agent.core.log.AgentLogger;
import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory;
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
import java.io.File;
import java.io.IOException;
diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoader.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoader.java
index 4d1b6885f82..6d028090d27 100644
--- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoader.java
+++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoader.java
@@ -36,9 +36,9 @@ public final class AgentServiceLoader<T> {
private final Collection<T> services;
- private AgentServiceLoader(final ClassLoader classLoader, final Class<T> service) {
+ private AgentServiceLoader(final Class<T> service) {
validate(service);
- this.services = load(classLoader, service);
+ this.services = load(service);
}
private void validate(final Class<T> service) {
@@ -46,9 +46,9 @@ public final class AgentServiceLoader<T> {
Preconditions.checkArgument(service.isInterface(), "SPI class `%s` is not interface.", service);
}
- private Collection<T> load(final ClassLoader classLoader, final Class<T> service) {
+ private Collection<T> load(final Class<T> service) {
Collection<T> result = new LinkedList<>();
- for (T each : ServiceLoader.load(service, classLoader)) {
+ for (T each : ServiceLoader.load(service)) {
result.add(each);
}
return result;
@@ -63,19 +63,6 @@ public final class AgentServiceLoader<T> {
*/
@SuppressWarnings("unchecked")
public static <T> AgentServiceLoader<T> getServiceLoader(final Class<T> service) {
- return AgentServiceLoader.getServiceLoader(Thread.currentThread().getContextClassLoader(), service);
- }
-
- /**
- * Get singleton agent service loader.
- *
- * @param classLoader class loader
- * @param service service type
- * @param <T> type of class
- * @return agent service loader
- */
- @SuppressWarnings("unchecked")
- public static <T> AgentServiceLoader<T> getServiceLoader(final ClassLoader classLoader, final Class<T> service) {
- return (AgentServiceLoader<T>) LOADERS.computeIfAbsent(service, key -> new AgentServiceLoader<>(classLoader, service));
+ return (AgentServiceLoader<T>) LOADERS.computeIfAbsent(service, AgentServiceLoader::new);
}
}
diff --git a/agent/log/log-to-slf4j/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.log.spi.AgentLoggerFactorySPI b/agent/core/src/main/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator
similarity index 91%
rename from agent/log/log-to-slf4j/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.log.spi.AgentLoggerFactorySPI
rename to agent/core/src/main/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator
index da4b26b7542..8983dc323f8 100644
--- a/agent/log/log-to-slf4j/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.log.spi.AgentLoggerFactorySPI
+++ b/agent/core/src/main/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.agent.log.slf4j.SLF4JAgentLoggerFactory
+org.apache.shardingsphere.agent.core.log.config.LogbackConfiguration
diff --git a/agent/log/log-api/pom.xml b/agent/log/log-api/pom.xml
deleted file mode 100644
index 3abbb90be9a..00000000000
--- a/agent/log/log-api/pom.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-agent-log</artifactId>
- <version>5.3.2-SNAPSHOT</version>
- </parent>
- <artifactId>shardingsphere-agent-log-api</artifactId>
- <name>${project.artifactId}</name>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jul-to-slf4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/agent/log/log-api/src/main/java/org/apache/shardingsphere/agent/log/api/impl/NOPAgentLogger.java b/agent/log/log-api/src/main/java/org/apache/shardingsphere/agent/log/api/impl/NOPAgentLogger.java
deleted file mode 100644
index 4c31c5b578c..00000000000
--- a/agent/log/log-api/src/main/java/org/apache/shardingsphere/agent/log/api/impl/NOPAgentLogger.java
+++ /dev/null
@@ -1,56 +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.agent.log.api.impl;
-
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
-
-/**
- * NOP (no operation) agent logger.
- */
-public final class NOPAgentLogger implements AgentLogger {
-
- @Override
- public void info(final String msg) {
-
- }
-
- @Override
- public void info(final String format, final Object... arguments) {
-
- }
-
- @Override
- public void error(final String format, final Object... arguments) {
-
- }
-
- @Override
- public void error(final String msg) {
-
- }
-
- @Override
- public void debug(final String format, final Object... arguments) {
-
- }
-
- @Override
- public void debug(final String msg) {
-
- }
-}
diff --git a/agent/log/log-api/src/main/java/org/apache/shardingsphere/agent/log/spi/AgentLoggerFactorySPI.java b/agent/log/log-api/src/main/java/org/apache/shardingsphere/agent/log/spi/AgentLoggerFactorySPI.java
deleted file mode 100644
index b82a3632fca..00000000000
--- a/agent/log/log-api/src/main/java/org/apache/shardingsphere/agent/log/spi/AgentLoggerFactorySPI.java
+++ /dev/null
@@ -1,42 +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.agent.log.spi;
-
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
-
-/**
- * Agent logger factory.
- */
-public interface AgentLoggerFactorySPI {
-
- /**
- * Get agent logger.
- *
- * @param clazz clazz
- * @return agent logger
- */
- AgentLogger getAgentLogger(Class<?> clazz);
-
- /**
- * Get agent logger.
- *
- * @param name name
- * @return agent logger
- */
- AgentLogger getAgentLogger(String name);
-}
diff --git a/agent/log/log-to-slf4j/pom.xml b/agent/log/log-to-slf4j/pom.xml
deleted file mode 100644
index 6381ff31a10..00000000000
--- a/agent/log/log-to-slf4j/pom.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-agent-log</artifactId>
- <version>5.3.2-SNAPSHOT</version>
- </parent>
- <artifactId>shardingsphere-agent-log-to-slf4j</artifactId>
- <name>${project.artifactId}</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-agent-log-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/agent/log/log-to-slf4j/src/main/java/org/apache/shardingsphere/agent/log/slf4j/SLF4JAgentLoggerFactory.java b/agent/log/log-to-slf4j/src/main/java/org/apache/shardingsphere/agent/log/slf4j/SLF4JAgentLoggerFactory.java
deleted file mode 100644
index d7c6502c7db..00000000000
--- a/agent/log/log-to-slf4j/src/main/java/org/apache/shardingsphere/agent/log/slf4j/SLF4JAgentLoggerFactory.java
+++ /dev/null
@@ -1,43 +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.agent.log.slf4j;
-
-import org.apache.shardingsphere.agent.log.api.AgentLogger;
-import org.apache.shardingsphere.agent.log.spi.AgentLoggerFactorySPI;
-import org.slf4j.LoggerFactory;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * SLF4J agent logger factory.
- */
-public final class SLF4JAgentLoggerFactory implements AgentLoggerFactorySPI {
-
- private static final Map<String, AgentLogger> LOGGER_MAP = new ConcurrentHashMap<>();
-
- @Override
- public AgentLogger getAgentLogger(final Class<?> clazz) {
- return getAgentLogger(clazz.getName());
- }
-
- @Override
- public AgentLogger getAgentLogger(final String name) {
- return LOGGER_MAP.computeIfAbsent(name, key -> new SLF4JAgentLogger(LoggerFactory.getLogger(name)));
- }
-}
diff --git a/agent/log/pom.xml b/agent/log/pom.xml
deleted file mode 100644
index 067b9a3fd84..00000000000
--- a/agent/log/pom.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-agent</artifactId>
- <version>5.3.2-SNAPSHOT</version>
- </parent>
- <artifactId>shardingsphere-agent-log</artifactId>
- <packaging>pom</packaging>
- <name>${project.artifactId}</name>
-
- <modules>
- <module>log-api</module>
- <module>log-to-slf4j</module>
- </modules>
-</project>
diff --git a/agent/pom.xml b/agent/pom.xml
index 5b89fa711b8..a66e7864252 100644
--- a/agent/pom.xml
+++ b/agent/pom.xml
@@ -32,7 +32,6 @@
<module>api</module>
<module>core</module>
<module>plugins</module>
- <module>log</module>
</modules>
<properties>
diff --git a/distribution/agent/pom.xml b/distribution/agent/pom.xml
index 92fc080f1d8..9018cccb5c3 100644
--- a/distribution/agent/pom.xml
+++ b/distribution/agent/pom.xml
@@ -64,17 +64,6 @@
<artifactId>shardingsphere-agent-tracing-opentelemetry</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-agent-log-to-slf4j</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>compile</scope>
- </dependency>
</dependencies>
<profiles>
diff --git a/distribution/agent/src/main/assembly/shardingsphere-agent-binary-distribution.xml b/distribution/agent/src/main/assembly/shardingsphere-agent-binary-distribution.xml
index 2d2393f1753..2af0035e8ca 100644
--- a/distribution/agent/src/main/assembly/shardingsphere-agent-binary-distribution.xml
+++ b/distribution/agent/src/main/assembly/shardingsphere-agent-binary-distribution.xml
@@ -92,15 +92,4 @@
</binaries>
</moduleSet>
</moduleSets>
-
- <dependencySets>
- <dependencySet>
- <outputDirectory>./log-lib</outputDirectory>
- <includes>
- <include>org.slf4j:slf4j-api</include>
- <include>ch.qos.logback:*</include>
- <include>org.apache.shardingsphere:shardingsphere-agent-log-to-slf4j</include>
- </includes>
- </dependencySet>
- </dependencySets>
</assembly>
diff --git a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/agent/conf/logback.xml b/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/agent/conf/logback.xml
deleted file mode 100644
index 9cd216e3516..00000000000
--- a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/agent/conf/logback.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.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.
- -->
-
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <root>
- <level value="info" />
- <appender-ref ref="console" />
- </root>
-</configuration>
diff --git a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/logback.xml b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/logback.xml
deleted file mode 100644
index 9cd216e3516..00000000000
--- a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/logback.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.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.
- -->
-
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <root>
- <level value="info" />
- <appender-ref ref="console" />
- </root>
-</configuration>
diff --git a/test/e2e/agent/plugins/tracing/opentelemetry/src/test/resources/docker/agent/conf/logback.xml b/test/e2e/agent/plugins/tracing/opentelemetry/src/test/resources/docker/agent/conf/logback.xml
deleted file mode 100644
index 9cd216e3516..00000000000
--- a/test/e2e/agent/plugins/tracing/opentelemetry/src/test/resources/docker/agent/conf/logback.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.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.
- -->
-
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <root>
- <level value="info" />
- <appender-ref ref="console" />
- </root>
-</configuration>
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/agent/conf/logback.xml b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/agent/conf/logback.xml
deleted file mode 100644
index 9cd216e3516..00000000000
--- a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/agent/conf/logback.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.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.
- -->
-
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <root>
- <level value="info" />
- <appender-ref ref="console" />
- </root>
-</configuration>