Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[log4j] migrate to log4j2 (#258) #305

Merged
merged 2 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@ matrix:
fast_finish: true
include:
- jdk: oraclejdk8
env:
env:
- DESC="Oracle JDK8 linting"
- CMD="mvn verify -B -Dhttps.protocols=TLSv1.2 -DskipTests -Dlog4j.configuration=log4j.travis.properties"
- CMD="mvn verify -B -Dhttps.protocols=TLSv1.2 -DskipTests -Dlog4j.configuration=log4j2.travis.properties"

- jdk: oraclejdk8
env:
env:
- DESC="Oracle JDK8 testing"
- CMD="mvn test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dlog4j.configuration=log4j.travis.properties"
- CMD="mvn test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dlog4j.configurationFile=log4j2.travis.properties"

- jdk: oraclejdk7
env:
env:
- DESC="Oracle JDK7 testing"
- CMD="mvn test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dlog4j.configuration=log4j.travis.properties"
- CMD="mvn test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dlog4j.configurationFile=log4j2.travis.properties"

- jdk: openjdk7
env:
env:
- DESC="OpenJDK7 testing"
- CMD="mvn test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dlog4j.configuration=log4j.travis.properties"
- CMD="mvn test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dlog4j.configurationFile=log4j2.travis.properties"

script: echo "Running $DESC..." && (eval $CMD)
script: echo "Running $DESC..." && (eval $CMD)

after_failure:
- for log in target/surefire-reports/*.txt; do echo "$log ========================" ; cat $log ; done
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ mvn checkstyle::check

`Checkstyle` analysis is automatically executed prior to compiling the code, testing.

# Generated code

JMXFetch uses [Lombok](https://projectlombok.org/) to modify classes and generate additional code at runtime.
You may need to [enable annotation processors](https://projectlombok.org/setup/overview) to compile in your IDE.

# Testing

To run unit test, issue the following command:
Expand Down
8 changes: 0 additions & 8 deletions log4j.travis.properties

This file was deleted.

9 changes: 9 additions & 0 deletions log4j2.travis.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rootLogger.level = info
rootLogger.appenderRef.stdout.ref = CONSOLE

appender.console.type = Console
appender.console.name = CONSOLE
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n
appender.console.filter.threshold.type = ThresholdFilter
appender.console.filter.threshold.level = info
23 changes: 20 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
<guava.version>17.0</guava.version>
<java-dogstatsd-client.version>2.1.0</java-dogstatsd-client.version>
<jcommander.version>1.35</jcommander.version>
<log4j.version>1.2.17</log4j.version>
<log4j.version>2.12.1</log4j.version>
<slf4j.version>1.7.26</slf4j.version>
<jackson.version>2.10.0</jackson.version>
<snakeyaml.version>1.13</snakeyaml.version>
<!-- Note: using project checkstyle with AOSP style
Expand Down Expand Up @@ -121,8 +122,19 @@
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
<exclusions>
<exclusion>
Expand All @@ -139,6 +151,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
Expand Down
Loading