Skip to content

Commit eaae9e3

Browse files
committed
Revamp file and delegating appenders
This PR splits the documentation of file appenders and the `Async`, `Failover`, `Rewrite` and `Routing` appenders into their own files. As in the previous PRs we: * check and reformat the configuration options, * add links to the Plugin Reference, * improve the readability of the description by shortening it and reformatting it, * remove examples to provide smaller ones that make the same point. Part of #2528.
1 parent f480fa1 commit eaae9e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2603
-1041
lines changed

pom.xml

+14
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,10 @@
334334
<site-commons-compress.version>1.26.2</site-commons-compress.version>
335335
<site-commons-csv.version>1.11.0</site-commons-csv.version>
336336
<site-commons-logging.version>1.3.3</site-commons-logging.version>
337+
<site-conversant.version>1.2.21</site-conversant.version>
337338
<site-disruptor.version>4.0.0</site-disruptor.version>
338339
<site-jackson.version>2.17.2</site-jackson.version>
340+
<site-jctools.version>4.0.5</site-jctools.version>
339341
<site-log4j-api.version>2.23.1</site-log4j-api.version>
340342
<site-log4j-core.version>2.23.1</site-log4j-core.version>
341343
<site-log4j-layout-template-json.version>2.23.1</site-log4j-layout-template-json.version>
@@ -747,6 +749,12 @@
747749
<version>${site-commons-logging.version}</version>
748750
</dependency>
749751

752+
<dependency>
753+
<groupId>com.conversantmedia</groupId>
754+
<artifactId>disruptor</artifactId>
755+
<version>${site-conversant.version}</version>
756+
</dependency>
757+
750758
<dependency>
751759
<groupId>com.lmax</groupId>
752760
<artifactId>disruptor</artifactId>
@@ -760,6 +768,12 @@
760768
<type>pom</type>
761769
</dependency>
762770

771+
<dependency>
772+
<groupId>org.jctools</groupId>
773+
<artifactId>jctools-core</artifactId>
774+
<version>${site-jctools.version}</version>
775+
</dependency>
776+
763777
<dependency>
764778
<groupId>ch.qos.logback</groupId>
765779
<artifactId>logback-core</artifactId>

src/site/antora/antora.tmpl.yml

+2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ asciidoc:
5454
commons-compress-version: "${site-commons-compress.version}"
5555
commons-csv-version: "${site-commons-csv.version}"
5656
commons-logging-version: "${site-commons-logging.version}"
57+
conversant-version: "${site-conversant.version}"
5758
disruptor-version: "${site-disruptor.version}"
5859
jackson-version: "${site-jackson.version}"
60+
jctools-version: "${site-jctools.version}"
5961
log4j-api-version: "${log4j-api.version}"
6062
log4j-core-version: "${site-log4j-core.version}"
6163
log4j-layout-template-json-version: "${site-log4j-layout-template-json.version}"

src/site/antora/antora.yml

+2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ asciidoc:
5454
commons-compress-version: "1.2.3-commons-compress"
5555
commons-csv-version: "1.2.3-commons-csv"
5656
commons-logging-version: "1.2.3-commons-logging"
57+
conversant-version: "1.2.3-conversant"
5758
disruptor-version: "1.2.3-disruptor"
5859
jackson-version: "1.2.3-jackson"
60+
jctools-version: "1.2.3-jctools"
5961
log4j-api-version: "1.2.3-api"
6062
log4j-core-version: "1.2.3-core"
6163
log4j-layout-template-json-version: "1.2.3-layout-template-json"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"Configuration": {
3+
"Appenders": {
4+
// tag::appenders[]
5+
"File": {
6+
"name": "FILE",
7+
"fileName": "app.log"
8+
},
9+
"Async": {
10+
"name": "ASYNC"
11+
}
12+
// end::appenders[]
13+
},
14+
"Loggers": {
15+
"Root": {
16+
"level": "INFO",
17+
"AppenderRef": {
18+
"ref": "ASYNC"
19+
}
20+
}
21+
}
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. 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+
# tag::appenders[]
19+
appender.0.type = File
20+
appender.0.name = FILE
21+
appender.0.fileName = app.log
22+
23+
appender.1.type = Async
24+
appender.1.name = ASYNC
25+
appender.1.appenderRef.type = AppenderRef
26+
appender.1.appenderRef.ref = FILE
27+
# end::appenders[]
28+
29+
rootLogger.level = INFO
30+
rootLogger.appenderRef.0.ref = ASYNC
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to you under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. 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+
<Configuration xmlns="https://logging.apache.org/xml/ns"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="
21+
https://logging.apache.org/xml/ns
22+
https://logging.apache.org/xml/ns/log4j-config-2.xsd">
23+
<Appenders>
24+
<!-- tag::appenders[] -->
25+
<File name="FILE"
26+
fileName="app.log">
27+
<JsonTemplateLayout/>
28+
</File>
29+
<Async name="ASYNC">
30+
<AppenderRef ref="FILE"/>
31+
</Async>
32+
<!-- end::appenders[] -->
33+
</Appenders>
34+
<Loggers>
35+
<Root level="INFO">
36+
<AppenderRef ref="ASYNC"/>
37+
</Root>
38+
</Loggers>
39+
</Configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. 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+
Configuration:
18+
Appenders:
19+
# tag::appenders[]
20+
File:
21+
name: "FILE"
22+
fileName: "app.log"
23+
Async:
24+
name: "ASYNC"
25+
AppenderRef:
26+
ref: "FILE"
27+
# end::appenders[]
28+
Loggers:
29+
Root:
30+
level: "INFO"
31+
AppenderRef:
32+
ref: "ASYNC"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"Configuration": {
3+
"Appenders": {
4+
// tag::appenders[]
5+
"File": {
6+
"name": "FILE",
7+
"fileName": "app.log",
8+
"ignoreExceptions": false // <1>
9+
},
10+
"Console": {
11+
"name": "CONSOLE"
12+
},
13+
"Failover": {
14+
"name": "FAILOVER",
15+
"primary": "FILE",
16+
"Failovers": {
17+
"AppenderRef": {
18+
"ref": "CONSOLE"
19+
}
20+
}
21+
}
22+
// end::appenders[]
23+
},
24+
"Loggers": {
25+
"Root": {
26+
"level": "INFO",
27+
"AppenderRef": {
28+
"ref": "FAILOVER"
29+
}
30+
}
31+
}
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. 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+
# tag::appenders[]
19+
appender.0.type = File
20+
appender.0.name = FILE
21+
appender.0.fileName = app.log
22+
appender.0.ignoreExceptions = false
23+
24+
appender.1.type = Console
25+
appender.1.name = CONSOLE
26+
27+
appender.2.type = Failover
28+
appender.2.name = FAILOVER
29+
appender.2.primary = FILE
30+
appender.2.fail.type = Failovers
31+
appender.2.fail.0.type = AppenderRef
32+
appender.2.fail.0.ref = CONSOLE
33+
# end::appenders[]
34+
35+
rootLogger.level = INFO
36+
rootLogger.appenderRef.0.ref = FAILOVER
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to you under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. 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+
<Configuration xmlns="https://logging.apache.org/xml/ns"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="
21+
https://logging.apache.org/xml/ns
22+
https://logging.apache.org/xml/ns/log4j-config-2.xsd">
23+
<Appenders>
24+
<!-- tag::appenders[] -->
25+
<File name="FILE"
26+
fileName="app.log"
27+
ignoreExceptions="false"/> <!--1-->
28+
<Console name="CONSOLE"/>
29+
<Failover name="FAILOVER"
30+
primary="FILE">
31+
<Failovers>
32+
<AppenderRef ref="CONSOLE"/>
33+
</Failovers>
34+
</Failover>
35+
<!-- end::appenders[] -->
36+
</Appenders>
37+
<Loggers>
38+
<Root level="INFO">
39+
<AppenderRef ref="FAILOVER"/>
40+
</Root>
41+
</Loggers>
42+
</Configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. 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+
Configuration:
18+
Appenders:
19+
# tag::appenders[]
20+
File:
21+
name: "FILE"
22+
fileName: "app.log"
23+
ignoreExceptions: false
24+
Console:
25+
name: "CONSOLE"
26+
Failover:
27+
name: "FAILOVER"
28+
primary: "FILE"
29+
Failovers:
30+
AppenderRef:
31+
ref: "CONSOLE"
32+
# end::appenders[]
33+
Loggers:
34+
Root:
35+
level: "INFO"
36+
AppenderRef:
37+
ref: "FAILOVER"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"Configuration": {
3+
"Appenders": {
4+
"Console": {
5+
"name": "CONSOLE",
6+
"JsonTemplateLayout": {}
7+
},
8+
// tag::appender[]
9+
"Rewrite": {
10+
"name": "REWRITE",
11+
"LoggerNameLevelRewritePolicy": { // <1>
12+
"logger": "org.example",
13+
"KeyValuePair": [
14+
{
15+
"key": "WARN",
16+
"value": "INFO"
17+
},
18+
{
19+
"key": "INFO",
20+
"value": "DEBUG"
21+
}
22+
]
23+
},
24+
"AppenderRef": {
25+
"level": "INFO", // <2>
26+
"ref": "CONSOLE"
27+
}
28+
}
29+
// end::appender[]
30+
},
31+
"Loggers": {
32+
"Root": {
33+
"level": "INFO",
34+
"AppenderRef": {
35+
"ref": "REWRITE"
36+
}
37+
}
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)