Skip to content

Commit

Permalink
add config for arthas-logback
Browse files Browse the repository at this point in the history
  • Loading branch information
qifanwang committed May 16, 2024
1 parent e0eea9e commit 115c6e4
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<property name="baseDir" value="/opt/logs/100004374" />
<property name="appName" value="xpipe-console" />
<property name="delayLogName" value="redis-delay" />
<property name="nettyClient" value="netty-client" />

<appender name="CONSOLE" class="com.alibaba.arthas.deps.ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%d{HH:mm:ss:SSS}][%p][%t][%X{class}]%message%xEx%n</pattern>
</encoder>
</appender>

<appender name="ROLLING" class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.RollingFileAppender">
<file>${baseDir}/${appName}-proxy-client.log</file>

<!-- 轮转策略 -->
<rollingPolicy class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${baseDir}/${appName}-%d{yyyy-MM-dd}-proxy-client-%i.log.gz</fileNamePattern>
<MaxHistory>30</MaxHistory>
<totalSizeCap>10GB</totalSizeCap>
<maxFileSize>100MB</maxFileSize>
</rollingPolicy>
<!-- 日志输出格式 -->
<encoder charset="utf-8">
<pattern>[%d{HH:mm:ss:SSS}][%p][%t][%c]%message%xEx%n</pattern>
</encoder>
</appender>

<logger name="org.springframework" level="INFO" />
<logger name="org.hibernate" level="INFO" />
<logger name="io.netty" level="INFO" />

<root level="INFO">
<appender-ref ref="ROLLING" />
</root>

</configuration>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MODE=service
PID_FOLDER=.
JAVA_OPTS="$JAVA_OPTS -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlogging.config=config/log4j2.xml -Dlog4j.configurationFile=config/log4j2.xml -Dlocalpath=config -DFXXPIPE_HOME=config"
JAVA_OPTS="$JAVA_OPTS -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlogging.config=config/log4j2.xml -Dlog4j.configurationFile=config/log4j2.xml -Darthas.logback.configurationFile=config/arthas-logback.xml -Dlocalpath=config -DFXXPIPE_HOME=config"
LOG_FOLDER=/opt/logs/100004374/
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ function changeAndMakeLogDir(){
makedir $logdir
#../xx.conf
sed -i 's#LOG_FOLDER=\(.*\)#LOG_FOLDER='"$logdir"'#' $current/../*.conf

// <property name="baseDir" value="/opt/logs/100004374" />
sed -i 's#name="baseDir">.*</Property>#name="baseDir">'$logdir'</Property>#' $current/../config/log4j2.xml
sed -i 's|<property name="baseDir" value="/opt/logs/[^"]*" />|<property name="baseDir" value="'$logdir'" />|' $current/../config/arthas-logback.xml
}
function changePort(){
conf=$1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<property name="baseDir" value="/opt/logs/100004376" />
<property name="appName" value="xpipe-keeper" />
<property name="delayLogName" value="redis-delay" />
<property name="nettyClient" value="netty-client" />

<appender name="CONSOLE" class="com.alibaba.arthas.deps.ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%d{HH:mm:ss:SSS}][%p][%t][%X{class}]%message%xEx%n</pattern>
</encoder>
</appender>

<appender name="ROLLING" class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.RollingFileAppender">
<file>${baseDir}/${appName}-proxy-client.log</file>

<!-- 轮转策略 -->
<rollingPolicy class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${baseDir}/${appName}-%d{yyyy-MM-dd}-proxy-client-%i.log.gz</fileNamePattern>
<MaxHistory>30</MaxHistory>
<totalSizeCap>10GB</totalSizeCap>
<maxFileSize>100MB</maxFileSize>
</rollingPolicy>
<!-- 日志输出格式 -->
<encoder charset="utf-8">
<pattern>[%d{HH:mm:ss:SSS}][%p][%t][%c]%message%xEx%n</pattern>
</encoder>
</appender>

<logger name="org.springframework" level="INFO" />
<logger name="org.hibernate" level="INFO" />
<logger name="io.netty" level="INFO" />

<root level="INFO">
<appender-ref ref="ROLLING" />
</root>

</configuration>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MODE=service
PID_FOLDER=.
JAVA_OPTS="$JAVA_OPTS -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlogging.config=config/log4j2.xml -Dlog4j.configurationFile=config/log4j2.xml -Dlocalpath=config"
JAVA_OPTS="$JAVA_OPTS -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlogging.config=config/log4j2.xml -Dlog4j.configurationFile=config/log4j2.xml -Darthas.logback.configurationFile=config/arthas-logback.xml -Dlocalpath=config"
LOG_FOLDER=/opt/logs/100004376/
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function changeAndMakeLogDir(){
#../xx.conf
sed -i 's#LOG_FOLDER=\(.*\)#LOG_FOLDER='"$logdir"'#' $current/../*.conf
sed -i 's#name="baseDir">.*</Property>#name="baseDir">'$logdir'</Property>#' $current/../config/log4j2.xml
sed -i 's|<property name="baseDir" value="/opt/logs/[^"]*" />|<property name="baseDir" value="'$logdir'" />|' $current/../config/arthas-logback.xml
}
function changeConfigLogFile() {
current=$1
Expand Down

0 comments on commit 115c6e4

Please sign in to comment.