Skip to content

Commit

Permalink
Make DubboAppender extends from FileAppender
Browse files Browse the repository at this point in the history
Tweak unit test log location
  • Loading branch information
biyuhao committed Jan 29, 2019
1 parent 2308a36 commit 1a103d1
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ script:

after_success:
- bash <(curl -s https://codecov.io/bash)

after_failure:
- if [ -f dubbo.log ]; then echo "------TAIL of dubbo.log------"; tail -n 1000 dubbo.log; echo "------END of dubbo.log------"; fi
1 change: 1 addition & 0 deletions dubbo-cluster/src/test/resources/log4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<appender name="DUBBO" class="org.apache.dubbo.common.utils.DubboAppender">
<param name="File" value="../dubbo.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n"/>
</layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@
*/
package org.apache.dubbo.common.utils;

import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.FileAppender;
import org.apache.log4j.spi.LoggingEvent;

import java.util.ArrayList;
import java.util.List;

public class DubboAppender extends ConsoleAppender {
public class DubboAppender extends FileAppender {

public DubboAppender() {
super();
setFile("dubbo.log");
}

public static boolean available = false;

Expand Down
1 change: 1 addition & 0 deletions dubbo-common/src/test/resources/log4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<!-- 以下是appender的定义 -->
<!-- ===================================================================== -->
<appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
<param name="File" value="../dubbo.log"/>
<param name="encoding" value="GBK"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<!-- The following is the definition of appender -->
<!-- ===================================================================== -->
<appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
<param name="File" value="../../dubbo.log"/>
<param name="encoding" value="GBK"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
Expand All @@ -30,14 +31,8 @@
<param name="LevelMax" value="DEBUG" />
</filter> -->
</appender>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{dd/MM/yy HH:mm:ss:SSS z}] %5p %c{2}: %m%n"/>
</layout>
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="dubbo"/>
<appender-ref ref="CONSOLE"/>
</root>
</log4j:configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<!-- 以下是appender的定义 -->
<!-- ===================================================================== -->
<appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
<param name="File" value="../../dubbo.log"/>
<param name="encoding" value="GBK"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
Expand Down
1 change: 1 addition & 0 deletions dubbo-rpc/dubbo-rpc-api/src/test/resources/log4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<!-- 以下是appender的定义 -->
<!-- ===================================================================== -->
<appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
<param name="File" value="../../dubbo.log"/>
<param name="encoding" value="GBK"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
Expand Down
12 changes: 2 additions & 10 deletions dubbo-rpc/dubbo-rpc-dubbo/src/test/resources/log4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<!-- 以下是appender的定义 -->
<!-- ===================================================================== -->
<appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
<param name="File" value="../../dubbo.log"/>
<param name="encoding" value="GBK"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
Expand All @@ -30,17 +31,8 @@
<param name="LevelMax" value="DEBUG" />
</filter> -->
</appender>
<appender name="FILE" class="org.apache.log4j.FileAppender">
<param name="File" value="dubbo.log"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- <param name="ConversionPattern" value="[%t %d{dd/MM/yy HH:mm:ss:SSS
z}] %5p %c{2}: %L %m%n" /> -->
<param name="ConversionPattern" value="[%t %l %d{dd/MM/yy HH:mm:ss:SSS z}] %5p %m %n"/>
</layout>
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="dubbo"/>
<appender-ref ref="FILE"/>
</root>
</log4j:configuration>
</log4j:configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
<param name="File" value="../../dubbo.log"/>
<param name="encoding" value="GBK"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
Expand Down

0 comments on commit 1a103d1

Please sign in to comment.