- 3.0.2-SNAPSHOT
+ 3.0.2
3.2.1
0.5.6-jdk17-SNAPSHOT
UTF-8
diff --git a/sofa-serverless-runtime/sofa-serverless-adapter-ext/pom.xml b/sofa-serverless-runtime/sofa-serverless-adapter-ext/pom.xml
index 9bdc21d57..c725f0730 100644
--- a/sofa-serverless-runtime/sofa-serverless-adapter-ext/pom.xml
+++ b/sofa-serverless-runtime/sofa-serverless-adapter-ext/pom.xml
@@ -13,6 +13,7 @@
pom
+ sofa-serverless-adapter-log4j2
sofa-serverless-adapter-logback
sofa-serverless-adapter-apollo
diff --git a/sofa-serverless-runtime/sofa-serverless-adapter-ext/sofa-serverless-adapter-log4j2/pom.xml b/sofa-serverless-runtime/sofa-serverless-adapter-ext/sofa-serverless-adapter-log4j2/pom.xml
new file mode 100644
index 000000000..ddab63580
--- /dev/null
+++ b/sofa-serverless-runtime/sofa-serverless-adapter-ext/sofa-serverless-adapter-log4j2/pom.xml
@@ -0,0 +1,75 @@
+
+
+ 4.0.0
+
+ com.alipay.sofa.serverless
+ sofa-serverless-adapter-ext
+ ${revision}
+ ../pom.xml
+
+ sofa-serverless-adapter-log4j2
+ ${revision}
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+ ${spring.boot.version}
+ provided
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-log4j2
+ ${spring.boot.version}
+ provided
+
+
+ com.alipay.sofa
+ sofa-ark-spi
+ provided
+
+
+
+
+
+
+ com.alipay.sofa
+ sofa-ark-plugin-maven-plugin
+ ${sofa.ark.version}
+
+
+ default-cli
+
+ ark-plugin
+
+
+
+
+ com.alipay.sofa.serverless.adapter.Log4j2AdapterActivator
+
+
+
+
+
+ org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
+
+
+
+
+ *:*:*
+ com.alipay.sofa.serverless:sofa-serverless-adapter-log4j2
+
+
+
+
+
+
+
+
diff --git a/sofa-serverless-runtime/sofa-serverless-adapter-ext/sofa-serverless-adapter-log4j2/src/main/java/com/alipay/sofa/serverless/adapter/Log4j2AdapterActivator.java b/sofa-serverless-runtime/sofa-serverless-adapter-ext/sofa-serverless-adapter-log4j2/src/main/java/com/alipay/sofa/serverless/adapter/Log4j2AdapterActivator.java
new file mode 100644
index 000000000..6f7c44c75
--- /dev/null
+++ b/sofa-serverless-runtime/sofa-serverless-adapter-ext/sofa-serverless-adapter-log4j2/src/main/java/com/alipay/sofa/serverless/adapter/Log4j2AdapterActivator.java
@@ -0,0 +1,35 @@
+/*
+ * 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 com.alipay.sofa.serverless.adapter;
+
+import com.alipay.sofa.ark.spi.model.PluginContext;
+import com.alipay.sofa.ark.spi.service.PluginActivator;
+
+/**
+ * @author lvjing2
+ * @since 0.5.5
+ */
+public class Log4j2AdapterActivator implements PluginActivator {
+ @Override
+ public void start(PluginContext context) {
+ }
+
+ @Override
+ public void stop(PluginContext context) {
+ // no op
+ }
+}
diff --git a/sofa-serverless-runtime/sofa-serverless-adapter-ext/sofa-serverless-adapter-log4j2/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java b/sofa-serverless-runtime/sofa-serverless-adapter-ext/sofa-serverless-adapter-log4j2/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
new file mode 100644
index 000000000..be6c496a3
--- /dev/null
+++ b/sofa-serverless-runtime/sofa-serverless-adapter-ext/sofa-serverless-adapter-log4j2/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
@@ -0,0 +1,522 @@
+/*
+ * 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.springframework.boot.context.logging;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.ThreadContext;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
+import org.springframework.boot.context.event.ApplicationFailedEvent;
+import org.springframework.boot.context.event.ApplicationPreparedEvent;
+import org.springframework.boot.context.event.ApplicationStartingEvent;
+import org.springframework.boot.context.properties.bind.Bindable;
+import org.springframework.boot.context.properties.bind.Binder;
+import org.springframework.boot.context.properties.source.ConfigurationPropertyName;
+import org.springframework.boot.logging.LogFile;
+import org.springframework.boot.logging.LogLevel;
+import org.springframework.boot.logging.LoggerGroup;
+import org.springframework.boot.logging.LoggerGroups;
+import org.springframework.boot.logging.LoggingInitializationContext;
+import org.springframework.boot.logging.LoggingSystem;
+import org.springframework.boot.logging.LoggingSystemProperties;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.SmartLifecycle;
+import org.springframework.context.event.ContextClosedEvent;
+import org.springframework.context.event.GenericApplicationListener;
+import org.springframework.core.Ordered;
+import org.springframework.core.ResolvableType;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.EnumerablePropertySource;
+import org.springframework.core.env.Environment;
+import org.springframework.core.log.LogMessage;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.util.StringUtils;
+
+import java.io.FileNotFoundException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.BiConsumer;
+
+/**
+ * An {@link ApplicationListener} that configures the {@link LoggingSystem}. If the
+ * environment contains a {@code logging.config} property it will be used to bootstrap the
+ * logging system, otherwise a default configuration is used. Regardless, logging levels
+ * will be customized if the environment contains {@code logging.level.*} entries and
+ * logging groups can be defined with {@code logging.group}.
+ *
+ * Debug and trace logging for Spring, Tomcat, Jetty and Hibernate will be enabled when
+ * the environment contains {@code debug} or {@code trace} properties that aren't set to
+ * {@code "false"} (i.e. if you start your application using
+ * {@literal java -jar myapp.jar [--debug | --trace]}). If you prefer to ignore these
+ * properties you can set {@link #setParseArgs(boolean) parseArgs} to {@code false}.
+ *
+ * By default, log output is only written to the console. If a log file is required, the
+ * {@code logging.file.path} and {@code logging.file.name} properties can be used.
+ *
+ * Some system properties may be set as side effects, and these can be useful if the
+ * logging configuration supports placeholders (i.e. log4j or logback):
+ *
+ * - {@code LOG_FILE} is set to the value of path of the log file that should be written
+ * (if any).
+ * - {@code PID} is set to the value of the current process ID if it can be determined.
+ *
+ *
+ *
+ * @author Dave Syer
+ * @author Phillip Webb
+ * @author Andy Wilkinson
+ * @author Madhura Bhave
+ * @author HaiTao Zhang
+ * @since 2.0.0
+ * @see LoggingSystem#get(ClassLoader)
+ */
+public class LoggingApplicationListener implements GenericApplicationListener {
+
+ private static final ConfigurationPropertyName LOGGING_LEVEL = ConfigurationPropertyName
+ .of("logging.level");
+
+ private static final ConfigurationPropertyName LOGGING_GROUP = ConfigurationPropertyName
+ .of("logging.group");
+
+ private static final Bindable