Skip to content

Commit bc33218

Browse files
committed
Link to example files and fix some JSON syntax
1 parent 204d825 commit bc33218

26 files changed

+210
-163
lines changed

src/site/antora/modules/ROOT/examples/manual/configuration/scripts.json

-65
This file was deleted.

src/site/antora/modules/ROOT/examples/manual/customlevels/log4j2.json

-41
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"Configuration": {
3+
"Appenders": {
4+
"Console": {
5+
"name": "CONSOLE",
6+
"PatternLayout": {
7+
"pattern": "%d [%t] %p %c - %m%n" // <1>
8+
}
9+
}
10+
},
11+
"CustomLevels": { // <4>
12+
"CustomLevel": [
13+
{
14+
"name": "INFO2",
15+
"intLevel": 375
16+
},
17+
{
18+
"name": "INFO3",
19+
"intLevel": 350
20+
},
21+
{
22+
"name": "INFO4",
23+
"intLevel": 325
24+
}
25+
]
26+
},
27+
"Loggers": {
28+
"Logger": {
29+
"name": "com.example",
30+
"level": "DEBUG" // <2>
31+
},
32+
"Root": {
33+
"level": "INFO2", // <5>
34+
"AppenderRef": {
35+
"ref": "CONSOLE",
36+
"level": "WARN" // <3>
37+
}
38+
}
39+
}
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"Configuration": {
3+
"Appenders": {
4+
"Console": {
5+
"name": "STDOUT",
6+
"PatternLayout": {
7+
"ScriptPatternSelector": {
8+
"defaultPattern": "%d %p %m%n",
9+
"ScriptRef": {
10+
"ref": "SELECTOR_SCRIPT",
11+
"PatternMatch": [
12+
{
13+
"key": "NoLocation",
14+
"pattern": "[%-5level] %c{1.} %msg%n"
15+
},
16+
{
17+
"key": "Flow",
18+
"pattern": "[%-5level] %c{1.} ====== %C{1.}.%M:%L %msg ======%n"
19+
}
20+
]
21+
}
22+
}
23+
}
24+
}
25+
},
26+
"Loggers": {
27+
"Logger": {
28+
"name": "EventLogger",
29+
"ScriptFilter": {
30+
"onMatch": "ACCEPT",
31+
"onMismatch": "DENY",
32+
"Script": {
33+
"name": "EVENT_LOGGER_FILTER",
34+
"language": "groovy",
35+
"scriptText": "if (logEvent.getMarker() != null && logEvent.getMarker().isInstanceOf('FLOW'))) { return true; } else if (logEvent.getContextMap().containsKey('UserId')) { return true; } return false;"
36+
}
37+
}
38+
},
39+
"Root": {
40+
"level": "INFO",
41+
"ScriptFilter": {
42+
"onMatch": "ACCEPT",
43+
"onMismatch": "DENY",
44+
"ScriptRef": {
45+
"ref": "ROOT_FILTER"
46+
}
47+
},
48+
"AppenderRef": {
49+
"ref": "STDOUT"
50+
}
51+
}
52+
},
53+
"Scripts": {
54+
"Script": {
55+
"name": "SELECTOR_SCRIPT",
56+
"language": "javascript",
57+
"scriptText": "var result; if (logEvent.getLoggerName().equals('JavascriptNoLocation')) { result = 'NoLocation'; } else if (logEvent.getMarker() != null && logEvent.getMarker().isInstanceOf('FLOW')) { result = 'Flow'; } result;"
58+
},
59+
"ScriptFile": {
60+
"name": "ROOT_FILTER",
61+
"path": "scripts/filter.groovy"
62+
}
63+
}
64+
}
65+
}

src/site/antora/modules/ROOT/pages/manual/async.adoc

+16-9
Original file line numberDiff line numberDiff line change
@@ -123,33 +123,36 @@ A configuration that mixes asynchronous loggers might look like:
123123
====
124124
XML::
125125
+
126+
.Snippet from an example {antora-examples-url}/manual/async/mixed-async.xml[`log4j2.xml`]
126127
[source,xml]
127128
----
128-
include::example$manual/configuration/mixed-async.xml[lines=1;18..-1]
129+
include::example$manual/async/mixed-async.xml[lines=31..40,indent=0]
129130
----
130131
131132
JSON::
132133
+
134+
.Snippet from an example {antora-examples-url}/manual/async/mixed-async.json[`log4j2.json`]
133135
[source,json]
134136
----
135-
include::example$manual/configuration/mixed-async.json[]
137+
include::example$manual/async/mixed-async.json[lines=17..36,indent=0]
136138
----
137139
138140
YAML::
139141
+
142+
.Snippet from an example {antora-examples-url}/manual/async/mixed-async.yaml[`log4j2.yaml`]
140143
[source,yaml]
141144
----
142-
include::example$manual/configuration/mixed-async.yaml[lines=17..-1]
145+
include::example$manual/async/mixed-async.yaml[lines=27..-1,indent=0]
143146
----
144147
145148
Properties::
146149
+
150+
.Snippet from an example {antora-examples-url}/manual/async/mixed-async.properties[`log4j2.properties`]
147151
[source,properties]
148152
----
149-
include::example$manual/configuration/mixed-async.properties[lines=17..-1]
153+
include::example$manual/async/mixed-async.properties[lines=28..-1]
150154
----
151155
====
152-
153156
<1> All the appenders referenced by `Root` and `Logger` are called synchronously.
154157
This is especially important for audit logging, since exceptions can be forwarded to the caller.
155158
<2> All the appenders references by `AsyncRoot` and `AsyncLogger` are called asynchronously.
@@ -194,30 +197,34 @@ to your configuration.
194197
====
195198
XML::
196199
+
200+
.Snippet from an example {antora-examples-url}/manual/async/custom-wait-strategy.xml[`log4j2.xml`]
197201
[source,xml]
198202
----
199-
include::example$manual/configuration/custom-wait-strategy.xml[lines=1;18..-1]
203+
include::example$manual/async/custom-wait-strategy.xml[lines=23,indent=0]
200204
----
201205
202206
JSON::
203207
+
208+
.Snippet from an example {antora-examples-url}/manual/async/custom-wait-strategy.json[`log4j2.json`]
204209
[source,json]
205210
----
206-
include::example$manual/configuration/custom-wait-strategy.json[]
211+
include::example$manual/async/custom-wait-strategy.json[lines=3..5,indent=0]
207212
----
208213
209214
YAML::
210215
+
216+
.Snippet from an example {antora-examples-url}/manual/async/custom-wait-strategy.yaml[`log4j2.yaml`]
211217
[source,yaml]
212218
----
213-
include::example$manual/configuration/custom-wait-strategy.yaml[lines=17..-1]
219+
include::example$manual/async/custom-wait-strategy.yaml[lines=18..-1]
214220
----
215221
216222
Properties::
217223
+
224+
.Snippet from an example {antora-examples-url}/manual/async/custom-wait-strategy.properties[`log4j2.properties`]
218225
[source,properties]
219226
----
220-
include::example$manual/configuration/custom-wait-strategy.properties[lines=17..-1]
227+
include::example$manual/async/custom-wait-strategy.properties[lines=17..-1]
221228
----
222229
====
223230

0 commit comments

Comments
 (0)