Skip to content

Commit

Permalink
Update log4j v1 to log4j v2 (openmessaging#156)
Browse files Browse the repository at this point in the history
tsunghanjacktsai authored Jun 13, 2022
1 parent b92a6c2 commit 4595c40
Showing 5 changed files with 95 additions and 54 deletions.
18 changes: 17 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -56,9 +56,25 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.2</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
32 changes: 0 additions & 32 deletions src/main/resources/log4j.properties

This file was deleted.

46 changes: 46 additions & 0 deletions src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Copyright 2017-2022 The DLedger Authors.
~ Licensed 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>
<Appenders>
<Console name="stdout" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c{1}:%L - %m%n"/>
</Console>
<RollingFile name="dledger" fileName="${sys:user.home}/logs/dledger/dledger.log"
filePattern="${sys:user.home}/logs/dledger/dledger.log.gz">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c{1}:%L - %m%n</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="500 MB" />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="RocketmqRemoting" level="error" additivity="false">
<AppenderRef ref="dledger"/>
</Logger>
<Logger name="io.openmessaging.storage.dledger.cmdline" level="info" additivity="false">
<AppenderRef ref="stdout"/>
</Logger>
<Root level="info">
<AppenderRef ref="dledger"/>
</Root>
</Loggers>
</Configuration>
21 changes: 0 additions & 21 deletions src/test/resources/log4j.properties

This file was deleted.

32 changes: 32 additions & 0 deletions src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2017-2022 The DLedger Authors.
~ Licensed 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>
<Appenders>
<Console name="stdout" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c{1}:%L - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="RocketmqRemoting" level="off" additivity="false">
<AppenderRef ref="stdout"/>
</Logger>
<Root level="off">
<AppenderRef ref="stdout"/>
</Root>
</Loggers>
</Configuration>

0 comments on commit 4595c40

Please sign in to comment.