Преглед изворни кода

Clean up Ctrip related codes (#4448)

kl пре 2 година
родитељ
комит
44c192de37

+ 0 - 11
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/config/BizConfig.java

@@ -109,17 +109,6 @@ public class BizConfig extends RefreshableConfig {
     return !getBooleanProperty("namespace.lock.switch", false);
   }
 
-  /**
-   * ctrip config
-   **/
-  public String cloggingUrl() {
-    return getValue("clogging.server.url");
-  }
-
-  public String cloggingPort() {
-    return getValue("clogging.server.port");
-  }
-
   public int appNamespaceCacheScanInterval() {
     int interval = getIntProperty("apollo.app-namespace-cache-scan.interval", DEFAULT_APPNAMESPACE_CACHE_SCAN_INTERVAL);
     return checkInt(interval, 1, Integer.MAX_VALUE, DEFAULT_APPNAMESPACE_CACHE_SCAN_INTERVAL);

+ 0 - 43
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/customize/BizLoggingCustomizer.java

@@ -1,43 +0,0 @@
-/*
- * Copyright 2022 Apollo Authors
- *
- * Licensed 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 com.ctrip.framework.apollo.biz.customize;
-
-import com.ctrip.framework.apollo.biz.config.BizConfig;
-import com.ctrip.framework.apollo.common.customize.LoggingCustomizer;
-import org.springframework.context.annotation.Profile;
-import org.springframework.stereotype.Component;
-
-@Component
-@Profile("ctrip")
-public class BizLoggingCustomizer extends LoggingCustomizer{
-
-  private final BizConfig bizConfig;
-
-  public BizLoggingCustomizer(final BizConfig bizConfig) {
-    this.bizConfig = bizConfig;
-  }
-
-  @Override
-  protected String cloggingUrl() {
-    return bizConfig.cloggingUrl();
-  }
-
-  @Override
-  protected String cloggingPort() {
-    return bizConfig.cloggingPort();
-  }
-}

+ 0 - 20
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/customize/package-info.java

@@ -1,20 +0,0 @@
-/*
- * Copyright 2022 Apollo Authors
- *
- * Licensed 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 com.ctrip.framework.apollo.biz.customize;

+ 0 - 100
apollo-common/src/main/java/com/ctrip/framework/apollo/common/customize/LoggingCustomizer.java

@@ -1,100 +0,0 @@
-/*
- * Copyright 2022 Apollo Authors
- *
- * Licensed 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 com.ctrip.framework.apollo.common.customize;
-
-import com.google.common.base.Strings;
-
-import com.ctrip.framework.apollo.tracer.Tracer;
-import com.ctrip.framework.foundation.Foundation;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.util.ClassUtils;
-import org.springframework.util.ReflectionUtils;
-
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.core.Appender;
-
-/**
- * clogging config.only used in ctrip
- * @author Jason Song(song_s@ctrip.com)
- */
-public abstract class LoggingCustomizer implements InitializingBean {
-  private static final Logger logger = LoggerFactory.getLogger(LoggingCustomizer.class);
-  private static final String cLoggingAppenderClass =
-      "com.ctrip.framework.clogging.agent.appender.CLoggingAppender";
-  private static boolean cLoggingAppenderPresent =
-      ClassUtils.isPresent(cLoggingAppenderClass, LoggingCustomizer.class.getClassLoader());
-
-  @Override
-  public void afterPropertiesSet() {
-    if (!cLoggingAppenderPresent) {
-      return;
-    }
-
-    try {
-      tryConfigCLogging();
-    } catch (Throwable ex) {
-      logger.error("Config CLogging failed", ex);
-      Tracer.logError(ex);
-    }
-
-  }
-
-  private void tryConfigCLogging() throws Exception {
-    String appId = Foundation.app().getAppId();
-    if (Strings.isNullOrEmpty(appId)) {
-      logger.warn("App id is null or empty!");
-      return;
-    }
-
-
-    LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
-    Class clazz = Class.forName(cLoggingAppenderClass);
-    Appender cLoggingAppender = (Appender) clazz.newInstance();
-
-    ReflectionUtils.findMethod(clazz, "setAppId", String.class).invoke(cLoggingAppender, appId);
-    ReflectionUtils.findMethod(clazz, "setServerIp", String.class)
-        .invoke(cLoggingAppender, cloggingUrl());
-    ReflectionUtils.findMethod(clazz, "setServerPort", int.class)
-        .invoke(cLoggingAppender, Integer.parseInt(cloggingPort()));
-
-    cLoggingAppender.setName("CentralLogging");
-    cLoggingAppender.setContext(loggerContext);
-    cLoggingAppender.start();
-
-    ch.qos.logback.classic.Logger logger =
-        (ch.qos.logback.classic.Logger) LoggerFactory.getLogger("root");
-    logger.addAppender(cLoggingAppender);
-
-  }
-
-  /**
-   * clogging server url
-   * @return
-   */
-  protected abstract String cloggingUrl();
-
-  /**
-   * clogging server port
-   * @return
-   */
-  protected abstract String cloggingPort();
-
-
-}

+ 0 - 20
apollo-common/src/main/java/com/ctrip/framework/apollo/common/customize/package-info.java

@@ -1,20 +0,0 @@
-/*
- * Copyright 2022 Apollo Authors
- *
- * Licensed 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 com.ctrip.framework.apollo.common.customize;