Skip to content

Commit 4595c40

Browse files
Update log4j v1 to log4j v2 (#156)
1 parent b92a6c2 commit 4595c40

File tree

5 files changed

+95
-54
lines changed

5 files changed

+95
-54
lines changed

pom.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,25 @@
5656
</dependency>
5757
<dependency>
5858
<groupId>org.slf4j</groupId>
59-
<artifactId>slf4j-log4j12</artifactId>
59+
<artifactId>slf4j-api</artifactId>
6060
<version>1.7.36</version>
6161
</dependency>
62+
<dependency>
63+
<groupId>org.apache.logging.log4j</groupId>
64+
<artifactId>log4j-slf4j-impl</artifactId>
65+
<version>2.17.2</version>
66+
</dependency>
67+
<dependency>
68+
<groupId>org.apache.logging.log4j</groupId>
69+
<artifactId>log4j-core</artifactId>
70+
<version>2.17.2</version>
71+
</dependency>
72+
73+
<dependency>
74+
<groupId>org.apache.logging.log4j</groupId>
75+
<artifactId>log4j-api</artifactId>
76+
<version>2.17.2</version>
77+
</dependency>
6278
<dependency>
6379
<groupId>org.junit.jupiter</groupId>
6480
<artifactId>junit-jupiter-api</artifactId>

src/main/resources/log4j.properties

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/main/resources/log4j2.xml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
~ Copyright 2017-2022 The DLedger Authors.
5+
6+
~ Licensed under the Apache License, Version 2.0 (the "License");
7+
~ you may not use this file except in compliance with the License.
8+
~ You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<Configuration>
20+
<Appenders>
21+
<Console name="stdout" target="SYSTEM_OUT">
22+
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c{1}:%L - %m%n"/>
23+
</Console>
24+
<RollingFile name="dledger" fileName="${sys:user.home}/logs/dledger/dledger.log"
25+
filePattern="${sys:user.home}/logs/dledger/dledger.log.gz">
26+
<PatternLayout>
27+
<Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c{1}:%L - %m%n</Pattern>
28+
</PatternLayout>
29+
<Policies>
30+
<SizeBasedTriggeringPolicy size="500 MB" />
31+
</Policies>
32+
<DefaultRolloverStrategy max="10"/>
33+
</RollingFile>
34+
</Appenders>
35+
<Loggers>
36+
<Logger name="RocketmqRemoting" level="error" additivity="false">
37+
<AppenderRef ref="dledger"/>
38+
</Logger>
39+
<Logger name="io.openmessaging.storage.dledger.cmdline" level="info" additivity="false">
40+
<AppenderRef ref="stdout"/>
41+
</Logger>
42+
<Root level="info">
43+
<AppenderRef ref="dledger"/>
44+
</Root>
45+
</Loggers>
46+
</Configuration>

src/test/resources/log4j.properties

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/test/resources/log4j2.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2017-2022 The DLedger Authors.
4+
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<Configuration>
19+
<Appenders>
20+
<Console name="stdout" target="SYSTEM_OUT">
21+
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c{1}:%L - %m%n"/>
22+
</Console>
23+
</Appenders>
24+
<Loggers>
25+
<Logger name="RocketmqRemoting" level="off" additivity="false">
26+
<AppenderRef ref="stdout"/>
27+
</Logger>
28+
<Root level="off">
29+
<AppenderRef ref="stdout"/>
30+
</Root>
31+
</Loggers>
32+
</Configuration>

0 commit comments

Comments
 (0)