This is an automated email from the ASF dual-hosted git repository.
lidongdai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new c63cd3e combine logback config of master/worker/alert/api server to
one (#1898)
c63cd3e is described below
commit c63cd3e237d7a32b7cad529dd99c4051abd8b86d
Author: dailidong <[email protected]>
AuthorDate: Thu Feb 6 11:08:06 2020 +0800
combine logback config of master/worker/alert/api server to one (#1898)
* combine logback config of master/worker/alert/api server to one
logback.xml
---
.../dolphinscheduler/conf/combined_logback.xml | 6 +-
.../conf/dolphinscheduler/conf/worker_logback.xml | 6 +-
.../src/main/resources/alert_logback.xml | 49 ------
.../src/main/resources/apiserver_logback.xml | 60 -------
.../src/main/resources/application-api.properties | 2 -
dolphinscheduler-common/pom.xml | 7 +
.../common}/log/MasterLogFilter.java | 2 +-
.../common}/log/SensitiveDataConverter.java | 6 +-
.../common}/log/TaskLogDiscriminator.java | 4 +-
.../common}/log/TaskLogFilter.java | 4 +-
.../common}/log/WorkerLogFilter.java | 6 +-
.../common}/utils/LoggerUtils.java | 9 +-
.../common/utils/SensitiveLogUtils.java | 4 +-
.../src/main/resources/logback.xml | 169 +++++++++++++++++++
.../common/log/MasterLogFilterTest.java | 118 ++++++++++++++
.../common/log/SensitiveDataConverterTest.java | 179 +++++++++++++++++++++
.../common/log/TaskLogDiscriminatorTest.java | 155 ++++++++++++++++++
.../common/log/TaskLogFilterTest.java | 120 ++++++++++++++
.../common/log/WorkerLogFilterTest.java | 119 ++++++++++++++
.../common/utils/LoggerUtilsTest.java | 26 +--
.../common/utils/SensitiveLogUtilsTest.java | 8 +-
.../server/utils/ProcessUtils.java | 1 +
.../server/worker/runner/TaskScheduleThread.java | 4 +-
.../worker/task/AbstractCommandExecutor.java | 2 +-
.../src/main/resources/master_logback.xml | 52 ------
.../src/main/resources/worker_logback.xml | 81 ----------
.../worker/log/SensitiveDataConverterTest.java | 92 -----------
.../worker/shell/ShellCommandExecutorTest.java | 2 +-
.../server/worker/sql/SqlExecutorTest.java | 2 +-
pom.xml | 1 +
script/dolphinscheduler-daemon.sh | 12 +-
31 files changed, 928 insertions(+), 380 deletions(-)
diff --git a/dockerfile/conf/dolphinscheduler/conf/combined_logback.xml
b/dockerfile/conf/dolphinscheduler/conf/combined_logback.xml
index 6bdb97c..7a9a5b4 100644
--- a/dockerfile/conf/dolphinscheduler/conf/combined_logback.xml
+++ b/dockerfile/conf/dolphinscheduler/conf/combined_logback.xml
@@ -31,8 +31,8 @@
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
- <filter
class="org.apache.dolphinscheduler.server.worker.log.TaskLogFilter"></filter>
- <Discriminator
class="org.apache.dolphinscheduler.server.worker.log.TaskLogDiscriminator">
+ <filter
class="org.apache.dolphinscheduler.common.log.TaskLogFilter"></filter>
+ <Discriminator
class="org.apache.dolphinscheduler.common.log.TaskLogDiscriminator">
<key>taskAppId</key>
<logBase>${log.base}</logBase>
</Discriminator>
@@ -52,7 +52,7 @@
<appender name="COMBINEDLOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.base}/dolphinscheduler-combined.log</file>
- <filter
class="org.apache.dolphinscheduler.server.worker.log.WorkerLogFilter">
+ <filter class="org.apache.dolphinscheduler.common.log.WorkerLogFilter">
<level>INFO</level>
</filter>
diff --git a/dockerfile/conf/dolphinscheduler/conf/worker_logback.xml
b/dockerfile/conf/dolphinscheduler/conf/worker_logback.xml
index 9bbd961..bf4a651 100644
--- a/dockerfile/conf/dolphinscheduler/conf/worker_logback.xml
+++ b/dockerfile/conf/dolphinscheduler/conf/worker_logback.xml
@@ -31,8 +31,8 @@
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
- <filter
class="org.apache.dolphinscheduler.server.worker.log.TaskLogFilter"></filter>
- <Discriminator
class="org.apache.dolphinscheduler.server.worker.log.TaskLogDiscriminator">
+ <filter
class="org.apache.dolphinscheduler.common.log.TaskLogFilter"></filter>
+ <Discriminator
class="org.apache.dolphinscheduler.common.log.TaskLogDiscriminator">
<key>taskAppId</key>
<logBase>${log.base}</logBase>
</Discriminator>
@@ -52,7 +52,7 @@
<appender name="WORKERLOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.base}/dolphinscheduler-worker.log</file>
- <filter
class="org.apache.dolphinscheduler.server.worker.log.WorkerLogFilter">
+ <filter class="org.apache.dolphinscheduler.common.log.WorkerLogFilter">
<level>INFO</level>
</filter>
diff --git a/dolphinscheduler-alert/src/main/resources/alert_logback.xml
b/dolphinscheduler-alert/src/main/resources/alert_logback.xml
deleted file mode 100644
index 3474df8..0000000
--- a/dolphinscheduler-alert/src/main/resources/alert_logback.xml
+++ /dev/null
@@ -1,49 +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.
- -->
-
-<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
-<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" -->
- <property name="log.base" value="logs" />
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>
- [%level] %date{yyyy-MM-dd HH:mm:ss.SSS}
%logger{96}:[%line] - %msg%n
- </pattern>
- <charset>UTF-8</charset>
- </encoder>
- </appender>
-
- <appender name="ALERTLOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.base}/dolphinscheduler-alert.log</file>
- <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-
<fileNamePattern>${log.base}/dolphinscheduler-alert.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
- <maxHistory>20</maxHistory>
- <maxFileSize>64MB</maxFileSize>
- </rollingPolicy>
- <encoder>
- <pattern>
- [%level] %date{yyyy-MM-dd HH:mm:ss.SSS}
%logger{96}:[%line] - %msg%n
- </pattern>
- <charset>UTF-8</charset>
- </encoder>
- </appender>
-
- <root level="INFO">
- <appender-ref ref="ALERTLOGFILE"/>
- </root>
-</configuration>
\ No newline at end of file
diff --git a/dolphinscheduler-api/src/main/resources/apiserver_logback.xml
b/dolphinscheduler-api/src/main/resources/apiserver_logback.xml
deleted file mode 100644
index 4c2ce0d..0000000
--- a/dolphinscheduler-api/src/main/resources/apiserver_logback.xml
+++ /dev/null
@@ -1,60 +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.
- -->
-
-<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
-<configuration scan="true" scanPeriod="120 seconds">
- <logger name="org.apache.zookeeper" level="WARN"/>
- <logger name="org.apache.hbase" level="WARN"/>
- <logger name="org.apache.hadoop" level="WARN"/>
-
- <property name="log.base" value="logs" />
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>
- [%level] %date{yyyy-MM-dd HH:mm:ss.SSS}
%logger{96}:[%line] - %msg%n
- </pattern>
- <charset>UTF-8</charset>
- </encoder>
- </appender>
-
- <appender name="APISERVERLOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <!-- Log level filter -->
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
- <file>${log.base}/dolphinscheduler-api-server.log</file>
- <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-
<fileNamePattern>${log.base}/dolphinscheduler-api-server.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
- <maxHistory>168</maxHistory>
- <maxFileSize>64MB</maxFileSize>
- </rollingPolicy>
-
- <encoder>
- <pattern>
- [%level] %date{yyyy-MM-dd HH:mm:ss.SSS}
%logger{96}:[%line] - %msg%n
- </pattern>
- <charset>UTF-8</charset>
- </encoder>
-
- </appender>
-
- <root level="INFO">
- <appender-ref ref="APISERVERLOGFILE" />
- </root>
-</configuration>
\ No newline at end of file
diff --git a/dolphinscheduler-api/src/main/resources/application-api.properties
b/dolphinscheduler-api/src/main/resources/application-api.properties
index 6ec304a..21f940b 100644
--- a/dolphinscheduler-api/src/main/resources/application-api.properties
+++ b/dolphinscheduler-api/src/main/resources/application-api.properties
@@ -15,8 +15,6 @@
# limitations under the License.
#
-logging.config=classpath:apiserver_logback.xml
-
# server port
server.port=12345
diff --git a/dolphinscheduler-common/pom.xml b/dolphinscheduler-common/pom.xml
index 955e956..bd2448e 100644
--- a/dolphinscheduler-common/pom.xml
+++ b/dolphinscheduler-common/pom.xml
@@ -29,6 +29,7 @@
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <codehaus.janino.version>3.1.0</codehaus.janino.version>
</properties>
<dependencies>
<dependency>
@@ -604,5 +605,11 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.codehaus.janino</groupId>
+ <artifactId>janino</artifactId>
+ <version>${codehaus.janino.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/log/MasterLogFilter.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/MasterLogFilter.java
similarity index 96%
rename from
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/log/MasterLogFilter.java
rename to
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/MasterLogFilter.java
index d6de484..7b5d53a 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/log/MasterLogFilter.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/MasterLogFilter.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dolphinscheduler.server.master.log;
+package org.apache.dolphinscheduler.common.log;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/SensitiveDataConverter.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/SensitiveDataConverter.java
similarity index 92%
rename from
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/SensitiveDataConverter.java
rename to
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/SensitiveDataConverter.java
index 4a98e66..971ce71 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/SensitiveDataConverter.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/SensitiveDataConverter.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dolphinscheduler.server.worker.log;
+package org.apache.dolphinscheduler.common.log;
import ch.qos.logback.classic.pattern.MessageConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import org.apache.dolphinscheduler.common.Constants;
+import org.apache.dolphinscheduler.common.utils.SensitiveLogUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
-import org.apache.dolphinscheduler.server.utils.SensitiveLogUtil;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -77,7 +77,7 @@ public class SensitiveDataConverter extends MessageConverter {
String password = matcher.group();
- String maskPassword = SensitiveLogUtil.maskDataSourcePwd(password);
+ String maskPassword =
SensitiveLogUtils.maskDataSourcePwd(password);
matcher.appendReplacement(sb, maskPassword);
}
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/TaskLogDiscriminator.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/TaskLogDiscriminator.java
similarity index 94%
rename from
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/TaskLogDiscriminator.java
rename to
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/TaskLogDiscriminator.java
index fa00aed..fd2b076 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/TaskLogDiscriminator.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/TaskLogDiscriminator.java
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dolphinscheduler.server.worker.log;
+package org.apache.dolphinscheduler.common.log;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.sift.AbstractDiscriminator;
import org.apache.dolphinscheduler.common.Constants;
-import org.apache.dolphinscheduler.server.utils.LoggerUtils;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
/**
* Task Log Discriminator
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/TaskLogFilter.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/TaskLogFilter.java
similarity index 93%
rename from
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/TaskLogFilter.java
rename to
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/TaskLogFilter.java
index 6398135..ac258da 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/TaskLogFilter.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/TaskLogFilter.java
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dolphinscheduler.server.worker.log;
+package org.apache.dolphinscheduler.common.log;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;
-import org.apache.dolphinscheduler.server.utils.LoggerUtils;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
/**
* task log filter
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/WorkerLogFilter.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/WorkerLogFilter.java
similarity index 91%
rename from
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/WorkerLogFilter.java
rename to
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/WorkerLogFilter.java
index 23758f9..abcc8bc 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/log/WorkerLogFilter.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/WorkerLogFilter.java
@@ -14,12 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dolphinscheduler.server.worker.log;
+package org.apache.dolphinscheduler.common.log;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
+
+import java.util.Arrays;
/**
* worker log filter
@@ -40,6 +43,7 @@ public class WorkerLogFilter extends Filter<ILoggingEvent> {
if (event.getThreadName().startsWith("Worker-")){
return FilterReply.ACCEPT;
}
+
return FilterReply.DENY;
}
public void setLevel(String level) {
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/LoggerUtils.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LoggerUtils.java
similarity index 91%
rename from
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/LoggerUtils.java
rename to
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LoggerUtils.java
index 8b40d94..fc08eb6 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/LoggerUtils.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LoggerUtils.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dolphinscheduler.server.utils;
+package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.slf4j.Logger;
@@ -45,6 +45,11 @@ public class LoggerUtils {
public static final String TASK_LOGGER_THREAD_NAME = "TaskLogInfo";
/**
+ * Task Logger Thread's name
+ */
+ public static final String TASK_APPID_LOG_FORMAT = "[taskAppId=";
+
+ /**
* build job id
*
* @param affix Task Logger's prefix
@@ -58,7 +63,7 @@ public class LoggerUtils {
int processInstId,
int taskId){
// - [taskAppId=TASK_79_4084_15210]
- return String.format(" - [taskAppId=%s-%s-%s-%s]",affix,
+ return String.format(" - %s%s-%s-%s-%s]",TASK_APPID_LOG_FORMAT,affix,
processDefId,
processInstId,
taskId);
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/SensitiveLogUtil.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SensitiveLogUtils.java
similarity index 93%
rename from
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/SensitiveLogUtil.java
rename to
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SensitiveLogUtils.java
index 948e92c..eab6c4f 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/SensitiveLogUtil.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SensitiveLogUtils.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dolphinscheduler.server.utils;
+package org.apache.dolphinscheduler.common.utils;
import org.apache.commons.lang.StringUtils;
import org.apache.dolphinscheduler.common.Constants;
@@ -22,7 +22,7 @@ import org.apache.dolphinscheduler.common.Constants;
/**
* sensitive log Util
*/
-public class SensitiveLogUtil {
+public class SensitiveLogUtils {
/**
* @param dataSourcePwd data source password
diff --git a/dolphinscheduler-common/src/main/resources/logback.xml
b/dolphinscheduler-common/src/main/resources/logback.xml
new file mode 100644
index 0000000..7f634da
--- /dev/null
+++ b/dolphinscheduler-common/src/main/resources/logback.xml
@@ -0,0 +1,169 @@
+<?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.
+ -->
+
+<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
+<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" -->
+
+ <property name="log.base" value="logs"/>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>
+ [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] -
%msg%n
+ </pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+
+
+ <!-- master server logback config start -->
+ <appender name="MASTERLOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.base}/dolphinscheduler-master.log</file>
+ <!--<filter
class="org.apache.dolphinscheduler.common.log.MasterLogFilter">
+ <level>INFO</level>
+ </filter>-->
+ <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+
<fileNamePattern>${log.base}/dolphinscheduler-master.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
+ <maxHistory>168</maxHistory>
+ <maxFileSize>200MB</maxFileSize>
+ </rollingPolicy>
+ <encoder>
+ <pattern>
+ [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] -
%msg%n
+ </pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+ <!-- master server logback config end -->
+
+
+ <!-- worker server logback config start -->
+ <conversionRule conversionWord="messsage"
+
converterClass="org.apache.dolphinscheduler.common.log.SensitiveDataConverter"/>
+ <appender name="TASKLOGFILE"
class="ch.qos.logback.classic.sift.SiftingAppender">
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>INFO</level>
+ </filter>
+ <filter class="org.apache.dolphinscheduler.common.log.TaskLogFilter"/>
+ <Discriminator
class="org.apache.dolphinscheduler.common.log.TaskLogDiscriminator">
+ <key>taskAppId</key>
+ <logBase>${log.base}</logBase>
+ </Discriminator>
+ <sift>
+ <appender name="FILE-${taskAppId}"
class="ch.qos.logback.core.FileAppender">
+ <file>${log.base}/${taskAppId}.log</file>
+ <encoder>
+ <pattern>
+ [%level] %date{yyyy-MM-dd HH:mm:ss.SSS}
%logger{96}:[%line] - %messsage%n
+ </pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ <append>true</append>
+ </appender>
+ </sift>
+ </appender>
+ <appender name="WORKERLOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.base}/dolphinscheduler-worker.log</file>
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>INFO</level>
+ </filter>
+ <filter
class="org.apache.dolphinscheduler.common.log.WorkerLogFilter"/>
+ <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+
<fileNamePattern>${log.base}/dolphinscheduler-worker.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
+ <maxHistory>168</maxHistory>
+ <maxFileSize>200MB</maxFileSize>
+ </rollingPolicy>
+ <encoder>
+ <pattern>
+ [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] -
%messsage%n
+ </pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+ <!-- worker server logback config end -->
+
+
+ <!-- alert server logback config start -->
+ <appender name="ALERTLOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.base}/dolphinscheduler-alert.log</file>
+ <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+
<fileNamePattern>${log.base}/dolphinscheduler-alert.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
+ <maxHistory>20</maxHistory>
+ <maxFileSize>64MB</maxFileSize>
+ </rollingPolicy>
+ <encoder>
+ <pattern>
+ [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] -
%msg%n
+ </pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+ <!-- alert server logback config end -->
+
+
+ <!-- api server logback config start -->
+ <appender name="APILOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.base}/dolphinscheduler-api-server.log</file>
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>INFO</level>
+ </filter>
+ <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+
<fileNamePattern>${log.base}/dolphinscheduler-api-server.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
+ <maxHistory>168</maxHistory>
+ <maxFileSize>64MB</maxFileSize>
+ </rollingPolicy>
+ <encoder>
+ <pattern>
+ [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] -
%msg%n
+ </pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+ <!-- api server logback config end -->
+
+ <logger name="org.apache.zookeeper" level="WARN"/>
+ <logger name="org.apache.hbase" level="WARN"/>
+ <logger name="org.apache.hadoop" level="WARN"/>
+
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT"/>
+
+ <if condition='p("server").contains("master-server")'>
+ <then>
+ <appender-ref ref="MASTERLOGFILE"/>
+ </then>
+ </if>
+ <if condition='p("server").contains("worker-server")'>
+ <then>
+ <appender-ref ref="TASKLOGFILE"/>
+ <appender-ref ref="WORKERLOGFILE"/>
+ </then>
+ </if>
+ <if condition='p("server").contains("alert-server")'>
+ <then>
+ <appender-ref ref="ALERTLOGFILE"/>
+ </then>
+ </if>
+ <if condition='p("server").contains("api-server")'>
+ <then>
+ <appender-ref ref="APILOGFILE"/>
+ </then>
+ </if>
+ </root>
+
+</configuration>
\ No newline at end of file
diff --git
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/MasterLogFilterTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/MasterLogFilterTest.java
new file mode 100644
index 0000000..8cf6cfc
--- /dev/null
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/MasterLogFilterTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.dolphinscheduler.common.log;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.classic.spi.IThrowableProxy;
+import ch.qos.logback.classic.spi.LoggerContextVO;
+import ch.qos.logback.core.spi.FilterReply;
+import org.apache.dolphinscheduler.common.Constants;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Marker;
+import java.util.Map;
+
+public class MasterLogFilterTest {
+
+ @Test
+ public void decide() {
+ MasterLogFilter masterLogFilter = new MasterLogFilter();
+
+
+ FilterReply filterReply = masterLogFilter.decide(new ILoggingEvent() {
+ @Override
+ public String getThreadName() {
+ return Constants.THREAD_NAME_MASTER_SERVER;
+ }
+
+ @Override
+ public Level getLevel() {
+ return Level.INFO;
+ }
+
+ @Override
+ public String getMessage() {
+ return "master insert into queue success, task : shell2";
+// return "consume tasks: [2_177_2_704_-1],there still have 0
tasks need to be executed";
+ }
+
+ @Override
+ public Object[] getArgumentArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public String getFormattedMessage() {
+ return "master insert into queue success, task : shell2";
+ }
+
+ @Override
+ public String getLoggerName() {
+ return null;
+ }
+
+ @Override
+ public LoggerContextVO getLoggerContextVO() {
+ return null;
+ }
+
+ @Override
+ public IThrowableProxy getThrowableProxy() {
+ return null;
+ }
+
+ @Override
+ public StackTraceElement[] getCallerData() {
+ return new StackTraceElement[0];
+ }
+
+ @Override
+ public boolean hasCallerData() {
+ return false;
+ }
+
+ @Override
+ public Marker getMarker() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMDCPropertyMap() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMdc() {
+ return null;
+ }
+
+ @Override
+ public long getTimeStamp() {
+ return 0;
+ }
+
+ @Override
+ public void prepareForDeferredProcessing() {
+
+ }
+ });
+
+ Assert.assertEquals(FilterReply.ACCEPT, filterReply);
+
+ }
+}
\ No newline at end of file
diff --git
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/SensitiveDataConverterTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/SensitiveDataConverterTest.java
new file mode 100644
index 0000000..727ab41
--- /dev/null
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/SensitiveDataConverterTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.dolphinscheduler.common.log;
+
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.classic.spi.IThrowableProxy;
+import ch.qos.logback.classic.spi.LoggerContextVO;
+import org.apache.dolphinscheduler.common.Constants;
+import org.apache.dolphinscheduler.common.utils.SensitiveLogUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class SensitiveDataConverterTest {
+
+ private final Logger logger =
LoggerFactory.getLogger(SensitiveDataConverterTest.class);
+
+ /**
+ * password pattern
+ */
+ private final Pattern pwdPattern =
Pattern.compile(Constants.DATASOURCE_PASSWORD_REGEX);
+
+ private final String logMsg =
"{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\"," +
+ "\"database\":\"carbond\"," +
+ "\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\"," +
+ "\"user\":\"view\"," +
+ "\"password\":\"view1\"}";
+
+ private final String maskLogMsg =
"{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\"," +
+ "\"database\":\"carbond\"," +
+ "\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\"," +
+ "\"user\":\"view\"," +
+ "\"password\":\"******\"}";
+ @Test
+ public void convert() {
+ SensitiveDataConverter sensitiveDataConverter = new
SensitiveDataConverter();
+ String result = sensitiveDataConverter.convert(new ILoggingEvent() {
+ @Override
+ public String getThreadName() {
+ return null;
+ }
+
+ @Override
+ public Level getLevel() {
+ return Level.INFO;
+ }
+
+ @Override
+ public String getMessage() {
+ return null;
+ }
+
+ @Override
+ public Object[] getArgumentArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public String getFormattedMessage() {
+ return logMsg;
+ }
+
+ @Override
+ public String getLoggerName() {
+ return null;
+ }
+
+ @Override
+ public LoggerContextVO getLoggerContextVO() {
+ return null;
+ }
+
+ @Override
+ public IThrowableProxy getThrowableProxy() {
+ return null;
+ }
+
+ @Override
+ public StackTraceElement[] getCallerData() {
+ return new StackTraceElement[0];
+ }
+
+ @Override
+ public boolean hasCallerData() {
+ return false;
+ }
+
+ @Override
+ public Marker getMarker() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMDCPropertyMap() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMdc() {
+ return null;
+ }
+
+ @Override
+ public long getTimeStamp() {
+ return 0;
+ }
+
+ @Override
+ public void prepareForDeferredProcessing() {
+
+ }
+ });
+
+ Assert.assertEquals(maskLogMsg, passwordHandler(pwdPattern, logMsg));
+
+ }
+
+ /**
+ * mask sensitive logMsg - sql task datasource password
+ */
+ @Test
+ public void testPwdLogMsgConverter() {
+ logger.info("parameter : {}", logMsg);
+ logger.info("parameter : {}", passwordHandler(pwdPattern, logMsg));
+
+ Assert.assertNotEquals(logMsg, passwordHandler(pwdPattern, logMsg));
+ Assert.assertEquals(maskLogMsg, passwordHandler(pwdPattern, logMsg));
+
+ }
+
+ /**
+ * password regex test
+ *
+ * @param logMsg original log
+ */
+ private static String passwordHandler(Pattern pattern, String logMsg) {
+
+ Matcher matcher = pattern.matcher(logMsg);
+
+ StringBuffer sb = new StringBuffer(logMsg.length());
+
+ while (matcher.find()) {
+
+ String password = matcher.group();
+
+ String maskPassword =
SensitiveLogUtils.maskDataSourcePwd(password);
+
+ matcher.appendReplacement(sb, maskPassword);
+ }
+ matcher.appendTail(sb);
+
+ return sb.toString();
+ }
+
+
+
+}
diff --git
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/TaskLogDiscriminatorTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/TaskLogDiscriminatorTest.java
new file mode 100644
index 0000000..8745a4f
--- /dev/null
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/TaskLogDiscriminatorTest.java
@@ -0,0 +1,155 @@
+/*
+ * 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.dolphinscheduler.common.log;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.classic.spi.IThrowableProxy;
+import ch.qos.logback.classic.spi.LoggerContextVO;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Marker;
+
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+public class TaskLogDiscriminatorTest {
+
+ /**
+ * log base
+ */
+ private String logBase = "logs";
+
+ TaskLogDiscriminator taskLogDiscriminator;
+
+ @Before
+ public void before(){
+ taskLogDiscriminator = new TaskLogDiscriminator();
+ taskLogDiscriminator.setLogBase("logs");
+ taskLogDiscriminator.setKey("123");
+ }
+
+ @Test
+ public void getDiscriminatingValue() {
+ String result = taskLogDiscriminator.getDiscriminatingValue(new
ILoggingEvent() {
+ @Override
+ public String getThreadName() {
+ return null;
+ }
+
+ @Override
+ public Level getLevel() {
+ return null;
+ }
+
+ @Override
+ public String getMessage() {
+ return null;
+ }
+
+ @Override
+ public Object[] getArgumentArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public String getFormattedMessage() {
+ return null;
+ }
+
+ @Override
+ public String getLoggerName() {
+ return "[taskAppId=TASK-1-1-1";
+ }
+
+ @Override
+ public LoggerContextVO getLoggerContextVO() {
+ return null;
+ }
+
+ @Override
+ public IThrowableProxy getThrowableProxy() {
+ return null;
+ }
+
+ @Override
+ public StackTraceElement[] getCallerData() {
+ return new StackTraceElement[0];
+ }
+
+ @Override
+ public boolean hasCallerData() {
+ return false;
+ }
+
+ @Override
+ public Marker getMarker() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMDCPropertyMap() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMdc() {
+ return null;
+ }
+
+ @Override
+ public long getTimeStamp() {
+ return 0;
+ }
+
+ @Override
+ public void prepareForDeferredProcessing() {
+
+ }
+ });
+ Assert.assertEquals("1/1/", result);
+ }
+
+ @Test
+ public void start() {
+ taskLogDiscriminator.start();
+ Assert.assertEquals(true, taskLogDiscriminator.isStarted());
+ }
+
+ @Test
+ public void getKey() {
+ Assert.assertEquals("123", taskLogDiscriminator.getKey());
+ }
+
+ @Test
+ public void setKey() {
+
+ taskLogDiscriminator.setKey("123");
+ }
+
+ @Test
+ public void getLogBase() {
+ Assert.assertEquals("logs", taskLogDiscriminator.getLogBase());
+ }
+
+ @Test
+ public void setLogBase() {
+ taskLogDiscriminator.setLogBase("logs");
+ }
+}
\ No newline at end of file
diff --git
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/TaskLogFilterTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/TaskLogFilterTest.java
new file mode 100644
index 0000000..5276707
--- /dev/null
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/TaskLogFilterTest.java
@@ -0,0 +1,120 @@
+/*
+ * 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.dolphinscheduler.common.log;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.classic.spi.IThrowableProxy;
+import ch.qos.logback.classic.spi.LoggerContextVO;
+import ch.qos.logback.core.spi.FilterReply;
+import org.apache.dolphinscheduler.common.Constants;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Marker;
+
+import java.util.Map;
+
+
+public class TaskLogFilterTest {
+
+ @Test
+ public void decide() {
+ TaskLogFilter taskLogFilter = new TaskLogFilter();
+
+
+ FilterReply filterReply = taskLogFilter.decide(new ILoggingEvent() {
+ @Override
+ public String getThreadName() {
+ return LoggerUtils.TASK_LOGGER_THREAD_NAME;
+ }
+
+ @Override
+ public Level getLevel() {
+ return Level.INFO;
+ }
+
+ @Override
+ public String getMessage() {
+ return "raw script : echo 222";
+ }
+
+ @Override
+ public Object[] getArgumentArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public String getFormattedMessage() {
+ return "raw script : echo 222";
+ }
+
+ @Override
+ public String getLoggerName() {
+ return null;
+ }
+
+ @Override
+ public LoggerContextVO getLoggerContextVO() {
+ return null;
+ }
+
+ @Override
+ public IThrowableProxy getThrowableProxy() {
+ return null;
+ }
+
+ @Override
+ public StackTraceElement[] getCallerData() {
+ return new StackTraceElement[0];
+ }
+
+ @Override
+ public boolean hasCallerData() {
+ return false;
+ }
+
+ @Override
+ public Marker getMarker() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMDCPropertyMap() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMdc() {
+ return null;
+ }
+
+ @Override
+ public long getTimeStamp() {
+ return 0;
+ }
+
+ @Override
+ public void prepareForDeferredProcessing() {
+
+ }
+ });
+
+ Assert.assertEquals(FilterReply.ACCEPT, filterReply);
+
+ }
+}
\ No newline at end of file
diff --git
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/WorkerLogFilterTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/WorkerLogFilterTest.java
new file mode 100644
index 0000000..90b1544
--- /dev/null
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/log/WorkerLogFilterTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.dolphinscheduler.common.log;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.classic.spi.IThrowableProxy;
+import ch.qos.logback.classic.spi.LoggerContextVO;
+import ch.qos.logback.core.spi.FilterReply;
+import org.apache.dolphinscheduler.common.Constants;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Marker;
+
+import java.util.Map;
+
+
+public class WorkerLogFilterTest {
+
+ @Test
+ public void decide() {
+ WorkerLogFilter workerLogFilter = new WorkerLogFilter();
+
+
+ FilterReply filterReply = workerLogFilter.decide(new ILoggingEvent() {
+ @Override
+ public String getThreadName() {
+ return Constants.THREAD_NAME_WORKER_SERVER;
+ }
+
+ @Override
+ public Level getLevel() {
+ return Level.INFO;
+ }
+
+ @Override
+ public String getMessage() {
+ return "consume tasks: [2_177_2_704_-1],there still have 0
tasks need to be executed";
+ }
+
+ @Override
+ public Object[] getArgumentArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public String getFormattedMessage() {
+ return "consume tasks: [2_177_2_704_-1],there still have 0
tasks need to be executed";
+ }
+
+ @Override
+ public String getLoggerName() {
+ return null;
+ }
+
+ @Override
+ public LoggerContextVO getLoggerContextVO() {
+ return null;
+ }
+
+ @Override
+ public IThrowableProxy getThrowableProxy() {
+ return null;
+ }
+
+ @Override
+ public StackTraceElement[] getCallerData() {
+ return new StackTraceElement[0];
+ }
+
+ @Override
+ public boolean hasCallerData() {
+ return false;
+ }
+
+ @Override
+ public Marker getMarker() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMDCPropertyMap() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getMdc() {
+ return null;
+ }
+
+ @Override
+ public long getTimeStamp() {
+ return 0;
+ }
+
+ @Override
+ public void prepareForDeferredProcessing() {
+
+ }
+ });
+
+ Assert.assertEquals(FilterReply.ACCEPT, filterReply);
+
+ }
+}
\ No newline at end of file
diff --git
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/SensitiveLogUtilTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/LoggerUtilsTest.java
similarity index 57%
copy from
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/SensitiveLogUtilTest.java
copy to
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/LoggerUtilsTest.java
index 2e5bfcf..5a80e38 100644
---
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/SensitiveLogUtilTest.java
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/LoggerUtilsTest.java
@@ -14,24 +14,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dolphinscheduler.server.utils;
+package org.apache.dolphinscheduler.common.utils;
-
-import org.apache.dolphinscheduler.common.Constants;
import org.junit.Assert;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.List;
-public class SensitiveLogUtilTest {
+public class LoggerUtilsTest {
+ private Logger logger = LoggerFactory.getLogger(LoggerUtilsTest.class);
@Test
- public void testMaskDataSourcePwd() {
+ public void buildTaskId() {
+
+ String taskId =
LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX,79,4084,15210);
- String password = "123456";
- String emptyPassword = "";
+ Assert.assertEquals(" - [taskAppId=TASK-79-4084-15210]", taskId);
+ }
- Assert.assertEquals(Constants.PASSWORD_DEFAULT,
SensitiveLogUtil.maskDataSourcePwd(password));
- Assert.assertEquals("",
SensitiveLogUtil.maskDataSourcePwd(emptyPassword));
+ @Test
+ public void getAppIds() {
+ List<String> appIdList = LoggerUtils.getAppIds("Running job:
application_1_1",logger);
+ Assert.assertEquals("application_1_1", appIdList.get(0));
}
-}
+}
\ No newline at end of file
diff --git
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/SensitiveLogUtilTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/SensitiveLogUtilsTest.java
similarity index 83%
rename from
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/SensitiveLogUtilTest.java
rename to
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/SensitiveLogUtilsTest.java
index 2e5bfcf..03880b6 100644
---
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/SensitiveLogUtilTest.java
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/SensitiveLogUtilsTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dolphinscheduler.server.utils;
+package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.Constants;
@@ -22,7 +22,7 @@ import org.junit.Assert;
import org.junit.Test;
-public class SensitiveLogUtilTest {
+public class SensitiveLogUtilsTest {
@Test
public void testMaskDataSourcePwd() {
@@ -30,8 +30,8 @@ public class SensitiveLogUtilTest {
String password = "123456";
String emptyPassword = "";
- Assert.assertEquals(Constants.PASSWORD_DEFAULT,
SensitiveLogUtil.maskDataSourcePwd(password));
- Assert.assertEquals("",
SensitiveLogUtil.maskDataSourcePwd(emptyPassword));
+ Assert.assertEquals(Constants.PASSWORD_DEFAULT,
SensitiveLogUtils.maskDataSourcePwd(password));
+ Assert.assertEquals("",
SensitiveLogUtils.maskDataSourcePwd(emptyPassword));
}
}
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
index 0b621a9..fd0a08c 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
+++
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
@@ -18,6 +18,7 @@ package org.apache.dolphinscheduler.server.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.CommonUtils;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskScheduleThread.java
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskScheduleThread.java
index 5f66c34..f179d63 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskScheduleThread.java
+++
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskScheduleThread.java
@@ -35,8 +35,8 @@ import org.apache.dolphinscheduler.dao.ProcessDao;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.permission.PermissionCheck;
-import org.apache.dolphinscheduler.server.utils.LoggerUtils;
-import org.apache.dolphinscheduler.server.worker.log.TaskLogDiscriminator;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
+import org.apache.dolphinscheduler.common.log.TaskLogDiscriminator;
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.server.worker.task.TaskManager;
import org.apache.dolphinscheduler.server.worker.task.TaskProps;
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
index 8774186..0c62f06 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
+++
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
@@ -23,7 +23,7 @@ import org.apache.dolphinscheduler.common.utils.HadoopUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.ProcessDao;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
-import org.apache.dolphinscheduler.server.utils.LoggerUtils;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.server.utils.ProcessUtils;
import org.slf4j.Logger;
diff --git a/dolphinscheduler-server/src/main/resources/master_logback.xml
b/dolphinscheduler-server/src/main/resources/master_logback.xml
deleted file mode 100644
index 54c3cf5..0000000
--- a/dolphinscheduler-server/src/main/resources/master_logback.xml
+++ /dev/null
@@ -1,52 +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.
- -->
-
-<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
-<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" -->
- <property name="log.base" value="logs" />
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>
- [%level] %date{yyyy-MM-dd HH:mm:ss.SSS}
%logger{96}:[%line] - %msg%n
- </pattern>
- <charset>UTF-8</charset>
- </encoder>
- </appender>
-
- <appender name="MASTERLOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.base}/dolphinscheduler-master.log</file>
- <filter
class="org.apache.dolphinscheduler.server.master.log.MasterLogFilter">
- <level>INFO</level>
- </filter>
- <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-
<fileNamePattern>${log.base}/dolphinscheduler-master.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
- <maxHistory>168</maxHistory>
- <maxFileSize>200MB</maxFileSize>
- </rollingPolicy>
- <encoder>
- <pattern>
- [%level] %date{yyyy-MM-dd HH:mm:ss.SSS}
%logger{96}:[%line] - %msg%n
- </pattern>
- <charset>UTF-8</charset>
- </encoder>
- </appender>
-
- <root level="INFO">
- <appender-ref ref="MASTERLOGFILE"/>
- </root>
-</configuration>
\ No newline at end of file
diff --git a/dolphinscheduler-server/src/main/resources/worker_logback.xml
b/dolphinscheduler-server/src/main/resources/worker_logback.xml
deleted file mode 100644
index 7ba0c9b..0000000
--- a/dolphinscheduler-server/src/main/resources/worker_logback.xml
+++ /dev/null
@@ -1,81 +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.
- -->
-
-<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
-<configuration scan="true" scanPeriod="120 seconds">
- <conversionRule conversionWord="msg"
-
converterClass="org.apache.dolphinscheduler.server.worker.log.SensitiveDataConverter"/>
- <property name="log.base" value="logs"/>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>
- [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] -
%msg%n
- </pattern>
- <charset>UTF-8</charset>
- </encoder>
- </appender>
- <appender name="TASKLOGFILE"
class="ch.qos.logback.classic.sift.SiftingAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
- <filter
class="org.apache.dolphinscheduler.server.worker.log.TaskLogFilter"/>
- <Discriminator
class="org.apache.dolphinscheduler.server.worker.log.TaskLogDiscriminator">
- <key>taskAppId</key>
- <logBase>${log.base}</logBase>
- </Discriminator>
- <sift>
- <appender name="FILE-${taskAppId}"
class="ch.qos.logback.core.FileAppender">
- <file>${log.base}/${taskAppId}.log</file>
- <encoder>
- <pattern>
- [%level] %date{yyyy-MM-dd HH:mm:ss.SSS}
%logger{96}:[%line] - %msg%n
- </pattern>
- <charset>UTF-8</charset>
- </encoder>
- <append>true</append>
- </appender>
- </sift>
- </appender>
-
- <appender name="WORKERLOGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.base}/dolphinscheduler-worker.log</file>
- <filter
class="org.apache.dolphinscheduler.server.worker.log.WorkerLogFilter">
- <level>INFO</level>
- </filter>
-
- <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-
<fileNamePattern>${log.base}/dolphinscheduler-worker.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
- <maxHistory>168</maxHistory>
- <maxFileSize>200MB</maxFileSize>
- </rollingPolicy>
-
- <encoder>
- <pattern>
- [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] -
%msg%n
- </pattern>
- <charset>UTF-8</charset>
- </encoder>
-
- </appender>
-
-
- <root level="INFO">
- <appender-ref ref="TASKLOGFILE"/>
- <appender-ref ref="WORKERLOGFILE"/>
- </root>
-</configuration>
\ No newline at end of file
diff --git
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/log/SensitiveDataConverterTest.java
b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/log/SensitiveDataConverterTest.java
deleted file mode 100644
index fb564a2..0000000
---
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/log/SensitiveDataConverterTest.java
+++ /dev/null
@@ -1,92 +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.dolphinscheduler.server.worker.log;
-
-
-import org.apache.dolphinscheduler.common.Constants;
-import org.apache.dolphinscheduler.server.utils.SensitiveLogUtil;
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class SensitiveDataConverterTest {
-
- private final Logger logger =
LoggerFactory.getLogger(SensitiveDataConverterTest.class);
-
- /**
- * password pattern
- */
- private final Pattern pwdPattern =
Pattern.compile(Constants.DATASOURCE_PASSWORD_REGEX);
-
-
- /**
- * mask sensitive logMsg - sql task datasource password
- */
- @Test
- public void testPwdLogMsgConverter() {
-
- String logMsg = "{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\"," +
- "\"database\":\"carbond\"," +
- "\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\"," +
- "\"user\":\"view\"," +
- "\"password\":\"view1\"}";
-
- String maskLogMsg =
"{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\"," +
- "\"database\":\"carbond\"," +
- "\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\"," +
- "\"user\":\"view\"," +
- "\"password\":\"******\"}";
-
-
- logger.info("parameter : {}", logMsg);
- logger.info("parameter : {}", passwordHandler(pwdPattern, logMsg));
-
- Assert.assertNotEquals(logMsg, passwordHandler(pwdPattern, logMsg));
- Assert.assertEquals(maskLogMsg, passwordHandler(pwdPattern, logMsg));
-
- }
-
- /**
- * password regex test
- *
- * @param logMsg original log
- */
- private static String passwordHandler(Pattern pattern, String logMsg) {
-
- Matcher matcher = pattern.matcher(logMsg);
-
- StringBuffer sb = new StringBuffer(logMsg.length());
-
- while (matcher.find()) {
-
- String password = matcher.group();
-
- String maskPassword = SensitiveLogUtil.maskDataSourcePwd(password);
-
- matcher.appendReplacement(sb, maskPassword);
- }
- matcher.appendTail(sb);
-
- return sb.toString();
- }
-
-
-}
diff --git
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/shell/ShellCommandExecutorTest.java
b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/shell/ShellCommandExecutorTest.java
index 1117fe0..04c8448 100644
---
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/shell/ShellCommandExecutorTest.java
+++
b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/shell/ShellCommandExecutorTest.java
@@ -23,7 +23,7 @@ import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.utils.SpringApplicationContext;
import org.apache.dolphinscheduler.dao.ProcessDao;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
-import org.apache.dolphinscheduler.server.utils.LoggerUtils;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.server.worker.task.TaskManager;
import org.apache.dolphinscheduler.server.worker.task.TaskProps;
diff --git
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/sql/SqlExecutorTest.java
b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/sql/SqlExecutorTest.java
index 7cf4b87..7da3f71 100644
---
a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/sql/SqlExecutorTest.java
+++
b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/sql/SqlExecutorTest.java
@@ -24,7 +24,7 @@ import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.utils.SpringApplicationContext;
import org.apache.dolphinscheduler.dao.ProcessDao;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
-import org.apache.dolphinscheduler.server.utils.LoggerUtils;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.server.worker.task.TaskManager;
import org.apache.dolphinscheduler.server.worker.task.TaskProps;
diff --git a/pom.xml b/pom.xml
index 0ff2f65..59278f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -675,6 +675,7 @@
<configuration>
<includes>
<include>**/common/utils/*.java</include>
+ <include>**/common/log/*.java</include>
<include>**/common/threadutils/*.java</include>
<include>**/common/graph/*.java</include>
<include>**/common/queue/*.java</include>
diff --git a/script/dolphinscheduler-daemon.sh
b/script/dolphinscheduler-daemon.sh
index b3310c3..d4db103 100644
--- a/script/dolphinscheduler-daemon.sh
+++ b/script/dolphinscheduler-daemon.sh
@@ -57,16 +57,16 @@ pid=$DOLPHINSCHEDULER_LOG_DIR/dolphinscheduler-$command.pid
cd $DOLPHINSCHEDULER_HOME
if [ "$command" = "api-server" ]; then
- LOG_FILE="-Dlogging.config=classpath:apiserver_logback.xml
-Dspring.profiles.active=api"
+ LOG_FILE="-Dserver=api-server -Dspring.profiles.active=api"
CLASS=org.apache.dolphinscheduler.api.ApiApplicationServer
elif [ "$command" = "master-server" ]; then
- LOG_FILE="-Dlogging.config=classpath:master_logback.xml
-Ddruid.mysql.usePingMethod=false"
+ LOG_FILE="-Dserver=master-server -Ddruid.mysql.usePingMethod=false"
CLASS=org.apache.dolphinscheduler.server.master.MasterServer
elif [ "$command" = "worker-server" ]; then
- LOG_FILE="-Dlogging.config=classpath:worker_logback.xml
-Ddruid.mysql.usePingMethod=false"
+ LOG_FILE="-Dserver=worker-server -Ddruid.mysql.usePingMethod=false"
CLASS=org.apache.dolphinscheduler.server.worker.WorkerServer
elif [ "$command" = "alert-server" ]; then
- LOG_FILE="-Dlogback.configurationFile=conf/alert_logback.xml"
+ LOG_FILE="-Dserver=alert-server"
CLASS=org.apache.dolphinscheduler.alert.AlertServer
elif [ "$command" = "logger-server" ]; then
CLASS=org.apache.dolphinscheduler.server.rpc.LoggerServer
@@ -93,8 +93,8 @@ case $startStop in
exec_command="$LOG_FILE $DOLPHINSCHEDULER_OPTS -classpath
$DOLPHINSCHEDULER_CONF_DIR:$DOLPHINSCHEDULER_LIB_JARS $CLASS"
- echo "nohup $JAVA_HOME/bin/java $exec_command > $log 2>&1 < /dev/null &"
- nohup $JAVA_HOME/bin/java $exec_command > $log 2>&1 < /dev/null &
+ echo "nohup $JAVA_HOME/bin/java $exec_command > $log 2>&1 > /dev/null &"
+ nohup $JAVA_HOME/bin/java $exec_command > $log 2>&1 > /dev/null &
echo $! > $pid
;;