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

aiceflower pushed a commit to branch release-0.9.4
in repository https://gitbox.apache.org/repos/asf/linkis.git

commit 84ab1f125d9495f8a80c9abb453c4824f7cf394a
Author: alexkun <[email protected]>
AuthorDate: Sun Feb 23 21:59:30 2020 +0800

    metadatamanager server update
---
 datasource/metadatamanager/server/pom.xml          |  91 ++++++++++++
 .../server/restful/MetadataCoreRestful.java        | 134 ++++++++++++++++++
 .../server/service/MetadataAppService.java         |  69 ++++++++++
 .../service/impl/MetadataAppServiceImpl.java       | 153 +++++++++++++++++++++
 .../server/src/main/resources/application.yml      |  29 ++++
 .../server/src/main/resources/linkis.properties    |  25 ++++
 .../server/src/main/resources/log4j.properties     |  33 +++++
 .../server/src/main/resources/log4j2.xml           |  35 +++++
 8 files changed, 569 insertions(+)

diff --git a/datasource/metadatamanager/server/pom.xml 
b/datasource/metadatamanager/server/pom.xml
new file mode 100644
index 0000000000..b9aa5f7fd2
--- /dev/null
+++ b/datasource/metadatamanager/server/pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2019 WeBank
+  ~ 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.
+  -->
+
+<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";>
+  <parent>
+    <artifactId>linkis</artifactId>
+    <groupId>com.webank.wedatasphere.linkis</groupId>
+    <version>0.9.4</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>linkis-metadatamanager-server</artifactId>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>com.webank.wedatasphere.linkis</groupId>
+      <artifactId>linkis-module</artifactId>
+      <version>${linkis.version}</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>asm</artifactId>
+          <groupId>org.ow2.asm</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <!--Metadata common-->
+    <dependency>
+      <groupId>com.webank.wedatasphere.linkis</groupId>
+      <artifactId>linkis-metadatamanager-common</artifactId>
+      <version>${linkis.version}</version>
+    </dependency>
+    <!-- data source manager common dependency-->
+    <dependency>
+      <groupId>com.webank.wedatasphere.linkis</groupId>
+      <artifactId>linkis-datasourcemanager-common</artifactId>
+      <version>${linkis.version}</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>asm</artifactId>
+          <groupId>org.ow2.asm</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <!--rpc-->
+    <dependency>
+      <groupId>com.webank.wedatasphere.linkis</groupId>
+      <artifactId>linkis-cloudRPC</artifactId>
+      <version>${linkis.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+      </plugin>
+
+      <plugin>
+        <groupId>net.alchim31.maven</groupId>
+        <artifactId>scala-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+      </plugin>
+    </plugins>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+      </resource>
+    </resources>
+    <finalName>${project.artifactId}-${project.version}</finalName>
+  </build>
+</project>
diff --git 
a/datasource/metadatamanager/server/src/main/java/com/webank/wedatasphere/linkis/metadatamanager/server/restful/MetadataCoreRestful.java
 
b/datasource/metadatamanager/server/src/main/java/com/webank/wedatasphere/linkis/metadatamanager/server/restful/MetadataCoreRestful.java
new file mode 100644
index 0000000000..63791c514d
--- /dev/null
+++ 
b/datasource/metadatamanager/server/src/main/java/com/webank/wedatasphere/linkis/metadatamanager/server/restful/MetadataCoreRestful.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2019 WeBank
+ * 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.webank.wedatasphere.linkis.metadatamanager.server.restful;
+
+import 
com.webank.wedatasphere.linkis.metadatamanager.common.domain.MetaColumnInfo;
+import 
com.webank.wedatasphere.linkis.metadatamanager.common.domain.MetaPartitionInfo;
+import 
com.webank.wedatasphere.linkis.metadatamanager.server.service.MetadataAppService;
+import com.webank.wedatasphere.linkis.server.Message;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author alexyang
+ * 2020/02/10
+ */
+@Path("/metadata")
+@Consumes(MediaType.APPLICATION_JSON)
+@Produces(MediaType.APPLICATION_JSON)
+@Component
+public class MetadataCoreRestful {
+
+    @Autowired
+    private MetadataAppService metadataAppService;
+
+    @GET
+    @Path("/dbs/{data_source_id}")
+    public Response getDatabases(@PathParam("data_source_id")String 
dataSourceId,
+                                 @QueryParam("system")String system){
+        try{
+            if(StringUtils.isBlank(system)){
+                return Message.messageToResponse(Message.error("'system' is 
missing[缺少系统名]"));
+            }
+            List<String> databases = 
metadataAppService.getDatabasesByDsId(dataSourceId, system);
+            return Message.messageToResponse(Message.ok().data("dbs", 
databases));
+        }catch(Exception e){
+            return Message.messageToResponse(
+                    Message.error("Fail to get database list[获取库信息失败], id:[" + 
dataSourceId +"], system:[" + system + "]", e));
+        }
+    }
+
+    @GET
+    @Path("/tables/{data_source_id}/db/{database}")
+    public Response getTables(@PathParam("data_source_id")String dataSourceId,
+                              @PathParam("database")String database,
+                              @QueryParam("system")String system){
+        try{
+            if(StringUtils.isBlank(system)){
+                return Message.messageToResponse(Message.error("'system' is 
missing[缺少系统名]"));
+            }
+            List<String> tables = 
metadataAppService.getTablesByDsId(dataSourceId, database, system);
+            return Message.messageToResponse(Message.ok().data("tables", 
tables));
+        }catch(Exception e){
+            return Message.messageToResponse(
+                    Message.error("Fail to get table list[获取表信息失败], id:[" + 
dataSourceId +"]" +
+                            ", system:[" + system + "], database:[" +database 
+"]", e));
+        }
+    }
+
+    @GET
+    @Path("/props/{data_source_id}/db/{database}/table/{table}")
+    public Response getTableProps(@PathParam("data_source_id")String 
dataSourceId,
+                                  @PathParam("database")String database,
+                                  @PathParam("table") String table,
+                                  @QueryParam("system")String system){
+        try{
+            if(StringUtils.isBlank(system)){
+                return Message.messageToResponse(Message.error("'system' is 
missing[缺少系统名]"));
+            }
+            Map<String, String> tableProps = 
metadataAppService.getTablePropsByDsId(dataSourceId, database, table, system);
+            return Message.messageToResponse(Message.ok().data("props", 
tableProps));
+        }catch(Exception e){
+            return Message.messageToResponse(
+                    Message.error("Fail to get table properties[获取表参数信息失败], 
id:[" + dataSourceId +"]" +
+                            ", system:[" + system + "], database:[" +database 
+"], table:[" + table +"]", e));
+        }
+    }
+
+    @GET
+    @Path("/partitions/{data_source_id}/db/{database}/table/{table}")
+    public Response getPartitions(@PathParam("data_source_id")String 
dataSourceId,
+                                  @PathParam("database")String database,
+                                  @PathParam("table") String table,
+                                  @QueryParam("system")String system){
+        try{
+            if(StringUtils.isBlank(system)){
+                return Message.messageToResponse(Message.error("'system' is 
missing[缺少系统名]"));
+            }
+            MetaPartitionInfo partitionInfo = 
metadataAppService.getPartitionsByDsId(dataSourceId, database, table, system);
+            return Message.messageToResponse(Message.ok().data("props", 
partitionInfo));
+        }catch(Exception e){
+            return Message.messageToResponse(
+                    Message.error("Fail to get partitions[获取表分区信息失败], id:[" + 
dataSourceId +"]" +
+                            ", system:[" + system + "], database:[" +database 
+"], table:[" + table +"]"));
+        }
+    }
+
+    @GET
+    @Path("/columns/{data_source_id}/db/{database}/table/{table}")
+    public Response getColumns(@PathParam("data_source_id")String dataSourceId,
+                               @PathParam("database")String database,
+                               @PathParam("table") String table,
+                               @QueryParam("system")String system){
+        try{
+            if(StringUtils.isBlank(system)){
+                return Message.messageToResponse(Message.error("'system' is 
missing[缺少系统名]"));
+            }
+            List<MetaColumnInfo> columns = 
metadataAppService.getColumns(dataSourceId, database, table, system);
+            return Message.messageToResponse(Message.ok().data("columns", 
columns));
+        }catch(Exception e){
+            return Message.messageToResponse(
+                    Message.error("Fail to get column list[获取表字段信息失败], id:[" + 
dataSourceId +"]" +
+                            ", system:[" + system + "], database:[" +database 
+"], table:[" + table +"]", e));
+        }
+    }
+
+}
diff --git 
a/datasource/metadatamanager/server/src/main/java/com/webank/wedatasphere/linkis/metadatamanager/server/service/MetadataAppService.java
 
b/datasource/metadatamanager/server/src/main/java/com/webank/wedatasphere/linkis/metadatamanager/server/service/MetadataAppService.java
new file mode 100644
index 0000000000..1656b94c08
--- /dev/null
+++ 
b/datasource/metadatamanager/server/src/main/java/com/webank/wedatasphere/linkis/metadatamanager/server/service/MetadataAppService.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2019 WeBank
+ * 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.webank.wedatasphere.linkis.metadatamanager.server.service;
+
+import com.webank.wedatasphere.linkis.common.exception.ErrorException;
+import 
com.webank.wedatasphere.linkis.metadatamanager.common.domain.MetaColumnInfo;
+import 
com.webank.wedatasphere.linkis.metadatamanager.common.domain.MetaPartitionInfo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author alexyang
+ * 2020/02/10
+ */
+public interface MetadataAppService {
+
+    /**
+     * @param dataSourceId data source id
+     * @param system system
+     * @return
+     */
+    List<String> getDatabasesByDsId(String dataSourceId, String system) throws 
ErrorException;
+
+    /**
+     * @param dataSourceId data source id
+     * @param system system
+     * @param database database
+     * @return
+     */
+    List<String> getTablesByDsId(String dataSourceId, String database, String 
system) throws ErrorException;
+
+    /**
+     * @param dataSourceId data source id
+     * @param database database
+     * @param table table
+     * @param system system
+     * @return
+     */
+    Map<String, String> getTablePropsByDsId(String dataSourceId, String 
database, String table, String system) throws ErrorException;
+    /**
+     * @param dataSourceId data source i
+     * @param database database
+     * @param table table
+     * @param system system
+     * @return
+     */
+    MetaPartitionInfo getPartitionsByDsId(String dataSourceId, String 
database, String table, String system) throws ErrorException;
+
+    /**
+     * @param dataSourceId data source id
+     * @param database database
+     * @param table table
+     * @param system system
+     * @return
+     */
+    List<MetaColumnInfo> getColumns(String dataSourceId, String database, 
String table, String system) throws ErrorException;
+}
diff --git 
a/datasource/metadatamanager/server/src/main/java/com/webank/wedatasphere/linkis/metadatamanager/server/service/impl/MetadataAppServiceImpl.java
 
b/datasource/metadatamanager/server/src/main/java/com/webank/wedatasphere/linkis/metadatamanager/server/service/impl/MetadataAppServiceImpl.java
new file mode 100644
index 0000000000..371e72640c
--- /dev/null
+++ 
b/datasource/metadatamanager/server/src/main/java/com/webank/wedatasphere/linkis/metadatamanager/server/service/impl/MetadataAppServiceImpl.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2019 WeBank
+ * 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.webank.wedatasphere.linkis.metadatamanager.server.service.impl;
+
+import com.webank.wedatasphere.linkis.common.exception.ErrorException;
+import com.webank.wedatasphere.linkis.datasourcemanager.common.util.json.Json;
+import 
com.webank.wedatasphere.linkis.datasourcemanager.common.protocol.DsInfoQueryRequest;
+import 
com.webank.wedatasphere.linkis.datasourcemanager.common.protocol.DsInfoResponse;
+import com.webank.wedatasphere.linkis.metadatamanager.common.MdmConfiguration;
+import 
com.webank.wedatasphere.linkis.metadatamanager.common.domain.MetaColumnInfo;
+import 
com.webank.wedatasphere.linkis.metadatamanager.common.domain.MetaPartitionInfo;
+import 
com.webank.wedatasphere.linkis.metadatamanager.server.service.MetadataAppService;
+import com.webank.wedatasphere.linkis.metadatamanager.common.protocol.*;
+import com.webank.wedatasphere.linkis.rpc.Sender;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author alexyang
+ * 2020/02/10
+ */
+@Service
+public class MetadataAppServiceImpl implements MetadataAppService {
+    private Sender dataSourceRpcSender;
+
+    @PostConstruct
+    public void init(){
+        dataSourceRpcSender = 
Sender.getSender(MdmConfiguration.DATA_SOURCE_SERVICE_APPLICATION.getValue());
+    }
+    @Override
+    public List<String> getDatabasesByDsId(String dataSourceId, String system) 
throws ErrorException {
+        DsInfoResponse dsInfoResponse = reqToGetDataSourceInfo(dataSourceId, 
system);
+        if(StringUtils.isNotBlank(dsInfoResponse.dsType())){
+            MetadataResponse metaQueryResponse = 
doAndGetMetaInfo(dsInfoResponse.dsType(),
+                    new MetaGetDatabases(dsInfoResponse.params(), 
dsInfoResponse.creator()));
+            return Json.fromJson(metaQueryResponse.data(), List.class, 
String.class);
+        }
+        return new ArrayList<>();
+    }
+
+    @Override
+    public List<String> getTablesByDsId(String dataSourceId, String database, 
String system) throws ErrorException {
+        DsInfoResponse dsInfoResponse = reqToGetDataSourceInfo(dataSourceId, 
system);
+        if(StringUtils.isNotBlank(dsInfoResponse.dsType())){
+            MetadataResponse metaQueryResponse = 
doAndGetMetaInfo(dsInfoResponse.dsType(),
+                    new MetaGetTables(dsInfoResponse.params(), database, 
dsInfoResponse.creator()));
+            return Json.fromJson(metaQueryResponse.data(), List.class, 
String.class);
+        }
+        return new ArrayList<>();
+    }
+
+    @Override
+    public Map<String, String> getTablePropsByDsId(String dataSourceId, String 
database, String table, String system) throws ErrorException {
+        DsInfoResponse dsInfoResponse = reqToGetDataSourceInfo(dataSourceId, 
system);
+        if(StringUtils.isNotBlank(dsInfoResponse.dsType())){
+            MetadataResponse metaQueryResponse = 
doAndGetMetaInfo(dsInfoResponse.dsType(),
+                    new MetaGetTableProps(dsInfoResponse.params(), database, 
table, dsInfoResponse.creator()));
+            return Json.fromJson(metaQueryResponse.data(), Map.class, 
String.class, String.class);
+        }
+        return new HashMap<>();
+    }
+
+    @Override
+    public MetaPartitionInfo getPartitionsByDsId(String dataSourceId, String 
database, String table, String system) throws ErrorException {
+        DsInfoResponse dsInfoResponse = reqToGetDataSourceInfo(dataSourceId, 
system);
+        if(StringUtils.isNotBlank(dsInfoResponse.dsType())){
+            MetadataResponse metaQueryResponse = 
doAndGetMetaInfo(dsInfoResponse.dsType(),
+                    new MetaGetPartitions(dsInfoResponse.params(), database, 
table, dsInfoResponse.creator()));
+            return Json.fromJson(metaQueryResponse.data(), 
MetaPartitionInfo.class);
+        }
+        return new MetaPartitionInfo();
+    }
+
+    @Override
+    public List<MetaColumnInfo> getColumns(String dataSourceId, String 
database, String table, String system) throws ErrorException {
+        DsInfoResponse dsInfoResponse = reqToGetDataSourceInfo(dataSourceId, 
system);
+        if(StringUtils.isNotBlank(dsInfoResponse.dsType())){
+            MetadataResponse metaQueryResponse = 
doAndGetMetaInfo(dsInfoResponse.dsType(),
+                    new MetaGetColumns(dsInfoResponse.params(), database, 
table, dsInfoResponse.creator()));
+            return Json.fromJson(metaQueryResponse.data(), List.class, 
MetaColumnInfo.class);
+        }
+        return new ArrayList<>();
+    }
+
+    /**
+     * Request to get data source information
+     * (type and connection parameters)
+     * @param dataSourceId data source id
+     * @param system system
+     * @return
+     * @throws ErrorException
+     */
+    public DsInfoResponse reqToGetDataSourceInfo(String dataSourceId, String 
system) throws ErrorException{
+        Object rpcResult = null;
+        try {
+            rpcResult = dataSourceRpcSender.ask(new 
DsInfoQueryRequest(dataSourceId, system));
+        }catch(Exception e){
+            throw new ErrorException(-1, "Remote Service Error[远端服务出错, 
联系运维处理]");
+        }
+        if(rpcResult instanceof DsInfoResponse){
+            DsInfoResponse response = (DsInfoResponse)rpcResult;
+            if(!response.status()){
+                throw new ErrorException(-1, "Error in Data Source Manager 
Server[数据源服务出错]");
+            }
+            return response;
+        }else{
+            throw new ErrorException(-1, "Remote Service Error[远端服务出错, 
联系运维处理]");
+        }
+    }
+
+    /**
+     * Request to get meta information
+     * @param dataSourceType
+     * @param request
+     * @return
+     */
+    public MetadataResponse doAndGetMetaInfo(String dataSourceType, 
MetadataQueryProtocol request) throws ErrorException {
+        Sender sender = 
Sender.getSender(MdmConfiguration.METADATA_SERVICE_APPLICATION.getValue() + "-" 
+ dataSourceType.toLowerCase());
+        Object rpcResult = null;
+        try{
+            rpcResult = sender.ask(request);
+        }catch(Exception e){
+            throw new ErrorException(-1, "Remote Service Error[远端服务出错, 
联系运维处理]");
+        }
+        if(rpcResult instanceof MetadataResponse){
+            MetadataResponse response = (MetadataResponse)rpcResult;
+            if(!response.status()){
+                throw new ErrorException(-1, "Error in 
["+dataSourceType.toUpperCase()+"] Metadata Service Server[元数据服务出错], " +
+                        "[" +response.data() + "]");
+            }
+            return response;
+        }else{
+            throw new ErrorException(-1, "Remote Service Error[远端服务出错, 
联系运维处理]");
+        }
+    }
+}
diff --git 
a/datasource/metadatamanager/server/src/main/resources/application.yml 
b/datasource/metadatamanager/server/src/main/resources/application.yml
new file mode 100644
index 0000000000..ad57812bc0
--- /dev/null
+++ b/datasource/metadatamanager/server/src/main/resources/application.yml
@@ -0,0 +1,29 @@
+server:
+  port: 8296
+spring:
+  application:
+    name: mdm-server
+
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://${ip}:${port}/eureka/
+  instance:
+    metadata-map:
+      test: wedatasphere
+
+management:
+  endpoints:
+    web:
+      exposure:
+        include: refresh,info
+logging:
+  config: classpath:log4j2.xml
+
+
+pagehelper:
+  helper-dialect: mysql
+  reasonable: true
+  support-methods-arguments: true
+  params: countSql
+
diff --git 
a/datasource/metadatamanager/server/src/main/resources/linkis.properties 
b/datasource/metadatamanager/server/src/main/resources/linkis.properties
new file mode 100644
index 0000000000..4cb512f592
--- /dev/null
+++ b/datasource/metadatamanager/server/src/main/resources/linkis.properties
@@ -0,0 +1,25 @@
+#
+# Copyright 2019 WeBank
+# 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.
+#
+
+wds.linkis.server.mybatis.mapperLocations=
+wds.linkis.server.mybatis.typeAliasesPackage=
+wds.linkis.server.mybatis.BasePackage=
+wds.linkis.server.restful.scan.packages=com.webank.wedatasphere.linkis.metadatamanager.server.restful
+
+#sit
+wds.linkis.server.version=v1
+
+#test
+wds.linkis.test.mode=true
+wds.linkis.test.user=davidhua
+
diff --git 
a/datasource/metadatamanager/server/src/main/resources/log4j.properties 
b/datasource/metadatamanager/server/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..d5ee44b86b
--- /dev/null
+++ b/datasource/metadatamanager/server/src/main/resources/log4j.properties
@@ -0,0 +1,33 @@
+#
+# Copyright 2019 WeBank
+# 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.
+#
+
+### set log levels ###
+
+log4j.rootCategory=INFO,console
+
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.Threshold=INFO
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+#log4j.appender.console.layout.ConversionPattern= %d{ISO8601} %-5p (%t) 
[%F:%M(%L)] - %m%n
+log4j.appender.console.layout.ConversionPattern= %d{ISO8601} %-5p (%t) %p 
%c{1} - %m%n
+
+
+log4j.appender.com.webank.bdp.ide.core=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.com.webank.bdp.ide.core.Threshold=INFO
+log4j.additivity.com.webank.bdp.ide.core=false
+log4j.appender.com.webank.bdp.ide.core.layout=org.apache.log4j.PatternLayout
+log4j.appender.com.webank.bdp.ide.core.Append=true
+log4j.appender.com.webank.bdp.ide.core.File=logs/linkis.log
+log4j.appender.com.webank.bdp.ide.core.layout.ConversionPattern= %d{ISO8601} 
%-5p (%t) [%F:%M(%L)] - %m%n
+
+log4j.logger.org.springframework=INFO
\ No newline at end of file
diff --git a/datasource/metadatamanager/server/src/main/resources/log4j2.xml 
b/datasource/metadatamanager/server/src/main/resources/log4j2.xml
new file mode 100644
index 0000000000..1c68190669
--- /dev/null
+++ b/datasource/metadatamanager/server/src/main/resources/log4j2.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2019 WeBank
+  ~ 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.
+  -->
+
+<configuration status="error" monitorInterval="30">
+    <appenders>
+        <Console name="Console" target="SYSTEM_OUT">
+            <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
+            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%t] 
%logger{36} %L %M - %msg%xEx%n"/>
+        </Console>
+        <RollingFile name="RollingFile" fileName="logs/linkis.log"
+                     
filePattern="logs/$${date:yyyy-MM}/linkis-log-%d{yyyy-MM-dd}-%i.log">
+            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] 
[%-40t] %c{1.} (%L) [%M] - %msg%xEx%n"/>
+            <SizeBasedTriggeringPolicy size="100MB"/>
+            <DefaultRolloverStrategy max="20"/>
+        </RollingFile>
+    </appenders>
+    <loggers>
+        <root level="INFO">
+            <appender-ref ref="RollingFile"/>
+            <appender-ref ref="Console"/>
+        </root>
+    </loggers>
+</configuration>
+


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to