This is an automated email from the ASF dual-hosted git repository.

jianglongtao 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 e50af1235f5 Remove logback dependency from agent core #28442 (#28443)
e50af1235f5 is described below

commit e50af1235f59ffbcf30fa8be305aaf0153ae6ef7
Author: jiangML <[email protected]>
AuthorDate: Fri Sep 15 14:06:58 2023 +0800

    Remove logback dependency from agent core #28442 (#28443)
---
 agent/core/pom.xml                                 | 13 ----
 .../core/log/config/LogbackConfiguration.java      | 84 ----------------------
 .../ch.qos.logback.classic.spi.Configurator        | 18 -----
 3 files changed, 115 deletions(-)

diff --git a/agent/core/pom.xml b/agent/core/pom.xml
index e3e67fdb1df..014a57a65ea 100644
--- a/agent/core/pom.xml
+++ b/agent/core/pom.xml
@@ -57,11 +57,6 @@
             <groupId>org.yaml</groupId>
             <artifactId>snakeyaml</artifactId>
         </dependency>
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-            <scope>compile</scope>
-        </dependency>
     </dependencies>
     
     <build>
@@ -96,14 +91,6 @@
                                     <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>
                             </relocations>
                         </configuration>
                     </execution>
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
deleted file mode 100644
index be82187b47b..00000000000
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/config/LogbackConfiguration.java
+++ /dev/null
@@ -1,84 +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.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(), 
"logs", "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/core/src/main/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator
 
b/agent/core/src/main/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator
deleted file mode 100644
index 8983dc323f8..00000000000
--- 
a/agent/core/src/main/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator
+++ /dev/null
@@ -1,18 +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.
-#
-
-org.apache.shardingsphere.agent.core.log.config.LogbackConfiguration

Reply via email to