You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ppkarwasz (via GitHub)" <gi...@apache.org> on 2024/07/22 15:03:30 UTC
[PR] Revamp rolling file appender documentation (logging-log4j2)
ppkarwasz opened a new pull request, #2764:
URL: https://github.com/apache/logging-log4j2/pull/2764
We split the documentation of rolling file appenders and minimize the repetition of configuration option descriptions and examples.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Revamp rolling file appender documentation (logging-log4j2)
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz merged PR #2764:
URL: https://github.com/apache/logging-log4j2/pull/2764
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Revamp rolling file appender documentation (logging-log4j2)
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on code in PR #2764:
URL: https://github.com/apache/logging-log4j2/pull/2764#discussion_r1693085316
##########
src/site/antora/modules/ROOT/examples/manual/rolling-file/script-condition.groovy:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+import java.nio.file.attribute.FileTime
+import java.nio.file.*
+import java.time.ZonedDateTime
+import java.util.stream.Collectors
+
+// tag::script[]
+def limit = FileTime.from(ZonedDateTime.now().minusDays(15).toInstant())
+def matcher = FileSystems.getDefault().getPathMatcher('glob:app.*.log.gz')
+statusLogger.info("Deleting files older than {}.", limit) // <1>
Review Comment:
As I discovered later, all scripts bind `configuration` to a `Configuration` object and `statusLogger` to the `StatusLogger`.
I found that adding status logger statements in scripts makes the life of debugging them much easier.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Revamp rolling file appender documentation (logging-log4j2)
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on code in PR #2764:
URL: https://github.com/apache/logging-log4j2/pull/2764#discussion_r1693073331
##########
src/site/antora/modules/ROOT/examples/manual/rolling-file/script-condition.groovy:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+import java.nio.file.attribute.FileTime
+import java.nio.file.*
+import java.time.ZonedDateTime
+import java.util.stream.Collectors
+
+// tag::script[]
+def limit = FileTime.from(ZonedDateTime.now().minusDays(15).toInstant())
+def matcher = FileSystems.getDefault().getPathMatcher('glob:app.*.log.gz')
+statusLogger.info("Deleting files older than {}.", limit) // <1>
Review Comment:
Is `statusLogger` indeed available? No need to import `StatusLogger` and call `getInstance()`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org