This is an automated email from the ASF dual-hosted git repository. liubao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git
commit f83c17336ce98f57d6ff952c10ff80ed9a74d8c4 Author: liubao <[email protected]> AuthorDate: Mon Mar 11 10:23:10 2019 +0800 默认使用log4j2 --- .../servicecomb/samples/porter/file/FileMain.java | 2 - .../file-service/src/main/resources/log4j2.xml | 43 ++++++++++++++++++++++ .../samples/porter/gateway/GatewayMain.java | 2 - .../gateway-service/src/main/resources/log4j2.xml | 43 ++++++++++++++++++++++ .../servicecomb/samples/porter/user/UserMain.java | 2 - .../user-service/src/main/resources/log4j2.xml | 43 ++++++++++++++++++++++ 6 files changed, 129 insertions(+), 6 deletions(-) diff --git a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java index 9b13142..ff57da5 100644 --- a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java +++ b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java @@ -18,11 +18,9 @@ package org.apache.servicecomb.samples.porter.file; import org.apache.servicecomb.foundation.common.utils.BeanUtils; -import org.apache.servicecomb.foundation.common.utils.Log4jUtils; public class FileMain { public static void main(String[] args) throws Exception { - Log4jUtils.init(); BeanUtils.init(); } } diff --git a/porter_lightweight/file-service/src/main/resources/log4j2.xml b/porter_lightweight/file-service/src/main/resources/log4j2.xml new file mode 100644 index 0000000..e3afdb6 --- /dev/null +++ b/porter_lightweight/file-service/src/main/resources/log4j2.xml @@ -0,0 +1,43 @@ +<?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. + --> + +<!--this is sample configuration, please modify as your wish--> + +<configuration> + <Properties> + <Property name="log_path">./file/log/</Property> + </Properties> + + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/> + </Console> + <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log" + filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log"> + <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/> + <TimeBasedTriggeringPolicy interval="1"/> + <SizeBasedTriggeringPolicy size="10 MB"/> + </RollingFile> + </Appenders> + <Loggers> + <Root level="info"> + <AppenderRef ref="Console"/> + <AppenderRef ref="DailyRollingFile"/> + </Root> + </Loggers> +</configuration> \ No newline at end of file diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java index 48c1824..a219d2d 100644 --- a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java +++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java @@ -18,11 +18,9 @@ package org.apache.servicecomb.samples.porter.gateway; import org.apache.servicecomb.foundation.common.utils.BeanUtils; -import org.apache.servicecomb.foundation.common.utils.Log4jUtils; public class GatewayMain { public static void main(String[] args) throws Exception { - Log4jUtils.init(); BeanUtils.init(); } } diff --git a/porter_lightweight/gateway-service/src/main/resources/log4j2.xml b/porter_lightweight/gateway-service/src/main/resources/log4j2.xml new file mode 100644 index 0000000..b51f28e --- /dev/null +++ b/porter_lightweight/gateway-service/src/main/resources/log4j2.xml @@ -0,0 +1,43 @@ +<?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. + --> + +<!--this is sample configuration, please modify as your wish--> + +<configuration> + <Properties> + <Property name="log_path">./gateway/log/</Property> + </Properties> + + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/> + </Console> + <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log" + filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log"> + <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/> + <TimeBasedTriggeringPolicy interval="1"/> + <SizeBasedTriggeringPolicy size="10 MB"/> + </RollingFile> + </Appenders> + <Loggers> + <Root level="info"> + <AppenderRef ref="Console"/> + <AppenderRef ref="DailyRollingFile"/> + </Root> + </Loggers> +</configuration> \ No newline at end of file diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java index 390b040..dc7b3ed 100644 --- a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java +++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java @@ -18,11 +18,9 @@ package org.apache.servicecomb.samples.porter.user; import org.apache.servicecomb.foundation.common.utils.BeanUtils; -import org.apache.servicecomb.foundation.common.utils.Log4jUtils; public class UserMain { public static void main(String[] args) throws Exception { - Log4jUtils.init(); BeanUtils.init(); } } diff --git a/porter_lightweight/user-service/src/main/resources/log4j2.xml b/porter_lightweight/user-service/src/main/resources/log4j2.xml new file mode 100644 index 0000000..3c70391 --- /dev/null +++ b/porter_lightweight/user-service/src/main/resources/log4j2.xml @@ -0,0 +1,43 @@ +<?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. + --> + +<!--this is sample configuration, please modify as your wish--> + +<configuration> + <Properties> + <Property name="log_path">./user/log/</Property> + </Properties> + + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/> + </Console> + <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log" + filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log"> + <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/> + <TimeBasedTriggeringPolicy interval="1"/> + <SizeBasedTriggeringPolicy size="10 MB"/> + </RollingFile> + </Appenders> + <Loggers> + <Root level="info"> + <AppenderRef ref="Console"/> + <AppenderRef ref="DailyRollingFile"/> + </Root> + </Loggers> +</configuration> \ No newline at end of file
