You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ha...@apache.org on 2018/04/26 03:07:09 UTC
[incubator-skywalking] branch master updated: Redirecting
apm-webapp log to rotatable file (#1119)
This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 70e51ab Redirecting apm-webapp log to rotatable file (#1119)
70e51ab is described below
commit 70e51ab6d3d087ce2330f73e47477c66f367834d
Author: Ajanthan <ba...@gmail.com>
AuthorDate: Wed Apr 25 20:07:01 2018 -0700
Redirecting apm-webapp log to rotatable file (#1119)
fix #931
---
apm-dist/bin/webappService.bat | 9 +++++++-
apm-dist/bin/webappService.sh | 5 ++++-
apm-webapp/src/main/resources/logback-spring.xml | 26 ++++++++++++++++++++++++
3 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/apm-dist/bin/webappService.bat b/apm-dist/bin/webappService.bat
index 22f182d..22dd6e9 100644
--- a/apm-dist/bin/webappService.bat
+++ b/apm-dist/bin/webappService.bat
@@ -20,6 +20,13 @@ setlocal
set WEBAPP_PROCESS_TITLE=Skywalking-Webapp
set WEBAPP_HOME=%~dp0%..
set JARPATH=%WEBAPP_HOME%\webapp
+set WEBAPP_LOG_DIR=%WEBAPP_HOME%\logs
+
+if exist "%WEBAPP_LOG_DIR%" (
+ mkdir "%WEBAPP_LOG_DIR%"
+)
+
+set LOG_FILE_LOCATION=%WEBAPP_LOG_DIR%\webapp.log
if defined JAVA_HOME (
set _EXECJAVA="%JAVA_HOME:"=%"\bin\java
@@ -30,5 +37,5 @@ if not defined JAVA_HOME (
set _EXECJAVA=java
)
-start "%WEBAPP_PROCESS_TITLE%" %_EXECJAVA% -jar %JARPATH%/skywalking-webapp.jar --server.port=8080 --collector.ribbon.listOfServers=127.0.0.1:10800
+start "%WEBAPP_PROCESS_TITLE%" %_EXECJAVA% -jar %JARPATH%/skywalking-webapp.jar --server.port=8080 --collector.ribbon.listOfServers=127.0.0.1:10800 --logging.file=%LOG_FILE_LOCATION%
endlocal
diff --git a/apm-dist/bin/webappService.sh b/apm-dist/bin/webappService.sh
index c915ff2..fdd52c4 100644
--- a/apm-dist/bin/webappService.sh
+++ b/apm-dist/bin/webappService.sh
@@ -28,12 +28,15 @@ if [ ! -d "${WEBAPP_HOME}/logs" ]; then
mkdir -p "${WEBAPP_LOG_DIR}"
fi
+LOG_FILE_LOCATION=${WEBAPP_LOG_DIR}/webapp.log
+
_RUNJAVA=${JAVA_HOME}/bin/java
[ -z "$JAVA_HOME" ] && _RUNJAVA=java
eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} -jar ${JAR_PATH}/skywalking-webapp.jar \
--server.port=8080 --collector.ribbon.listOfServers=127.0.0.1:10800 \
- 2>${WEBAPP_LOG_DIR}/webapp.log 1> /dev/null &"
+ --logging.file=${LOG_FILE_LOCATION} \
+ 2>${WEBAPP_LOG_DIR}/webapp-console.log 1> /dev/null &"
if [ $? -eq 0 ]; then
sleep 1
diff --git a/apm-webapp/src/main/resources/logback-spring.xml b/apm-webapp/src/main/resources/logback-spring.xml
new file mode 100644
index 0000000..3e017a7
--- /dev/null
+++ b/apm-webapp/src/main/resources/logback-spring.xml
@@ -0,0 +1,26 @@
+<?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.
+ ~
+ -->
+<configuration>
+ <include resource="org/springframework/boot/logging/logback/defaults.xml" />
+ <property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}"/>
+ <include resource="org/springframework/boot/logging/logback/file-appender.xml" />
+ <root level="INFO">
+ <appender-ref ref="FILE" />
+ </root>
+</configuration>
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
hanahmily@apache.org.