提交 70e51ab6 编写于 作者: A Ajanthan 提交者: Gao Hongtao

Redirecting apm-webapp log to rotatable file (#1119)

fix #931 
上级 adc29293
......@@ -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
......@@ -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
......
<?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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册