You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2018/04/26 03:07:02 UTC

[GitHub] hanahmily closed pull request #1119: Redirecting apm-webapp log to rotatable file

hanahmily closed pull request #1119: Redirecting apm-webapp log to rotatable file
URL: https://github.com/apache/incubator-skywalking/pull/1119
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/apm-dist/bin/webappService.bat b/apm-dist/bin/webappService.bat
index 22f182d72..22dd6e917 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 c915ff251..fdd52c48b 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 000000000..3e017a776
--- /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


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services