-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp rolling file appender documentation
We split the documentation of rolling file appenders and minimize the repetition of configuration option descriptions and examples.
- Loading branch information
Showing
28 changed files
with
2,574 additions
and
1,166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/site/antora/modules/ROOT/examples/manual/rolling-file/logrotate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"Configuration": { | ||
"Appenders": { | ||
// tag::appender[] | ||
"RollingFile": { | ||
"name": "FILE", | ||
"fileName": "/var/log/app.log", | ||
"filePattern": "/var/log/app.log.%i.gz", // <1> | ||
"JsonTemplateLayout": {}, | ||
"DefaultRolloverStrategy": { | ||
"max": 15 // <2> | ||
}, | ||
"Policies": { | ||
"CronTriggeringPolicy": { | ||
"schedule": "0 0 0 * * ?" // <3> | ||
}, | ||
"SizeBasedTriggeringPolicy": { | ||
"size": "100k" // <4> | ||
} | ||
} | ||
} | ||
// end::appender[] | ||
}, | ||
"Loggers": { | ||
"Root": { | ||
"level": "INFO", | ||
"AppenderRef": { | ||
"ref": "FILE" | ||
} | ||
} | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/site/antora/modules/ROOT/examples/manual/rolling-file/logrotate.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to you 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. | ||
# | ||
## | ||
# tag::appender[] | ||
appender.0.type = RollingFile | ||
appender.0.name = FILE | ||
appender.0.fileName = /var/log/app.log | ||
# <1> | ||
appender.0.filePattern = /var/log/app.log.%i.gz | ||
|
||
appender.0.layout.type = JsonTemplateLayout | ||
|
||
appender.0.strategy.type = DefaultRolloveStrategy | ||
# <2> | ||
appender.0.strategy.max = 15 | ||
|
||
appender.0.policy.type = Policies | ||
appender.0.policy.0.type = CronTriggeringPolicy | ||
# <3> | ||
appender.0.policy.0.schedule = 0 0 0 * * ? | ||
appender.0.policy.1.type = SizeBasedTriggeringPolicy | ||
# <4> | ||
appender.0.policy.1.size = 100k | ||
# end::appender[] | ||
|
||
rootLogger.level = INFO | ||
rootLogger.appenderRef.0.ref = FILE |
42 changes: 42 additions & 0 deletions
42
src/site/antora/modules/ROOT/examples/manual/rolling-file/logrotate.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
~ contributor license agreements. See the NOTICE file distributed with | ||
~ this work for additional information regarding copyright ownership. | ||
~ The ASF licenses this file to you 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 xmlns="https://logging.apache.org/xml/ns" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation=" | ||
https://logging.apache.org/xml/ns | ||
https://logging.apache.org/xml/ns/log4j-config-2.xsd"> | ||
<Appenders> | ||
<!-- tag::appender[] --> | ||
<RollingFile name="FILE" | ||
fileName="/var/log/app.log" | ||
filePattern="/var/log/app.log.%i.gz"> <!--1--> | ||
<JsonTemplateLayout/> | ||
<DefaultRolloverStrategy max="15"/> <!--2--> | ||
<Policies> | ||
<CronTriggeringPolicy schedule="0 0 0 * * ?"/> <!--3--> | ||
<SizeBasedTriggeringPolicy size="100k"/> <!--4--> | ||
</Policies> | ||
</RollingFile> | ||
<!-- end::appender[] --> | ||
</Appenders> | ||
<Loggers> | ||
<Root level="INFO"> | ||
<AppenderRef ref="FILE"/> | ||
</Root> | ||
</Loggers> | ||
</Configuration> |
37 changes: 37 additions & 0 deletions
37
src/site/antora/modules/ROOT/examples/manual/rolling-file/logrotate.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to you 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: | ||
# tag::appender[] | ||
RollingFile: | ||
name: "FILE" | ||
fileName: "/var/log/app.log" | ||
filePattern: "/var/log/app.log.%i.gz" # <1> | ||
JsonTemplateLayout: {} | ||
DefaultRolloverStrategy: | ||
max: 15 # <2> | ||
Policies: | ||
CronTriggeringPolicy: | ||
schedule: "0 0 0 * * ?" # <3> | ||
SizeBasedTriggeringPolicy: | ||
size: "100k" # <4> | ||
# end::appender[] | ||
Loggers: | ||
Root: | ||
level: "INFO" | ||
AppenderRef: | ||
ref: "FILE" |
31 changes: 31 additions & 0 deletions
31
src/site/antora/modules/ROOT/examples/manual/rolling-file/per-month.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"Configuration": { | ||
"Appenders": { | ||
// tag::appender[] | ||
"RollingFile": { | ||
"name": "FILE", | ||
"filePattern": "/var/log/app/%{yyyy-MM}/%d{yyyy-MM-dd}.log.gz", // <1> | ||
"JsonTemplateLayout": {}, | ||
"DirectWriteRolloverStrategy": { | ||
"Delete": { | ||
"basePath": "/var/log/app", | ||
"maxDepth": 2, // <2> | ||
"IfLastModified": { | ||
"age": "P90D" | ||
} | ||
} | ||
}, | ||
"TimeBasedTriggeringPolicy": {} | ||
} | ||
// end::appender[] | ||
}, | ||
"Loggers": { | ||
"Root": { | ||
"level": "INFO", | ||
"AppenderRef": { | ||
"ref": "FILE" | ||
} | ||
} | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/site/antora/modules/ROOT/examples/manual/rolling-file/per-month.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to you 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. | ||
# | ||
## | ||
# tag::appender[] | ||
appender.0.type = RollingFile | ||
appender.0.name = FILE | ||
# <1> | ||
appender.0.filePattern = /var/log/app/%d{yyyy-MM]/%d{yyyy-MM-dd}.log.gz | ||
|
||
appender.0.layout.type = JsonTemplateLayout | ||
|
||
appender.0.strategy.type = DirectWriteRolloverStrategy | ||
appender.0.strategy.delete.type = Delete | ||
appender.0.strategy.delete.basePath = /var/log/app | ||
# <2> | ||
appender.0.strategy.delete.maxDepth = 2 | ||
appender.0.strategy.delete.0.type = IfLastModified | ||
appender.0.strategy.delete.0.age = P90D | ||
|
||
appender.0.policy.type = TimeBaseTriggeringPolicy | ||
# end::appender[] | ||
|
||
rootLogger.level = INFO | ||
rootLogger.appenderRef.0.ref = FILE |
43 changes: 43 additions & 0 deletions
43
src/site/antora/modules/ROOT/examples/manual/rolling-file/per-month.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
~ contributor license agreements. See the NOTICE file distributed with | ||
~ this work for additional information regarding copyright ownership. | ||
~ The ASF licenses this file to you 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 xmlns="https://logging.apache.org/xml/ns" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation=" | ||
https://logging.apache.org/xml/ns | ||
https://logging.apache.org/xml/ns/log4j-config-2.xsd"> | ||
<Appenders> | ||
<!-- tag::appender[] --> | ||
<RollingFile name="FILE" | ||
filePattern="/var/log/app/%d{yyyy-MM}/%d{yyyy-MM-dd}.log.gz"> <!--1--> | ||
<JsonTemplateLayout/> | ||
<DirectWriteRolloverStrategy> | ||
<Delete basePath="/var/log/app" | ||
maxDepth="2"> <!--2--> | ||
<IfLastModified age="P90D"/> | ||
</Delete> | ||
</DirectWriteRolloverStrategy> | ||
<TimeBasedTriggeringPolicy/> | ||
</RollingFile> | ||
<!-- end::appender[] --> | ||
</Appenders> | ||
<Loggers> | ||
<Root level="INFO"> | ||
<AppenderRef ref="FILE"/> | ||
</Root> | ||
</Loggers> | ||
</Configuration> |
36 changes: 36 additions & 0 deletions
36
src/site/antora/modules/ROOT/examples/manual/rolling-file/per-month.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to you 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: | ||
# tag::appender[] | ||
RollingFile: | ||
name: "FILE" | ||
filePattern: "/var/log/app/%d{yyyy-MM}/%d{yyyy-MM-dd}.log.gz" # <1> | ||
JsonTemplateLayout: {} | ||
DirectWriteRolloverStrategy: | ||
Delete: | ||
basePath: "/var/log/app" | ||
maxDepth: 2 # <2> | ||
IfLastModified: | ||
age: "P90D" | ||
TimeBasedTriggeringPolicy: {} | ||
# end::appender[] | ||
Loggers: | ||
Root: | ||
level: "INFO" | ||
AppenderRef: | ||
ref: "FILE" |
27 changes: 27 additions & 0 deletions
27
src/site/antora/modules/ROOT/examples/manual/rolling-file/policies.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"Configuration": { | ||
"Appenders": { | ||
// tag::appender[] | ||
"RollingFile": { | ||
"name": "FILE", | ||
"fileName": "app.log", | ||
"filePattern": "app.%d{yyyy-MM-dd}.%i.log", | ||
"JsonTemplateLayout": {}, | ||
"Policies": { | ||
"OnStartupTriggeringPolicy": {}, | ||
"SizeBasedTriggeringPolicy": {}, | ||
"TimeBasedTriggeringPolicy": {} | ||
} | ||
} | ||
// end::appender[] | ||
}, | ||
"Loggers": { | ||
"Root": { | ||
"level": "INFO", | ||
"AppenderRef": { | ||
"ref": "FILE" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.