- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
第 1 天 程序开始并运行一整天。日志如期写入
第 2 天 当天的第一个 Activity 发生时午夜过后(一个 cron in我的情况)记录了 Activity ,第一天的所有数据都丢失了。此 Activity 记录为第 1 天 Activity
log4j.rootLogger=DEBUG, R
log4j.appender.R = org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File = ../log/ooo.log
log4j.appender.R.Append = true
log4j.appender.R.DatePattern = '.'yyyy-MM-dd
log4j.appender.R.layout = org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
示例:
在 ooo.log.2011-10-20
中,我希望找到 10-20 的 Activity 相反,我看到 10-21 的前几秒
我期望行为,如 specification 所定义的那样
'.'yyyy-MM-dd Rollover at midnight each day. At midnight, on March 8th, 2002, /foo/bar.log will be copied to /foo/bar.log.2002-03-08. Logging for the 9th day of March will be output to /foo/bar.log until it is rolled over the next day.
此外,请查看时间戳。它似乎是随机的,与我的 cron 被调用时的分钟标记一致。不管它做了什么,appender 的行为与其描述不一致。
这是怎么回事?请帮助我理解和纠正。
最佳答案
这也可能是一个程序的多个实例记录到同一个文件的症状;查看更多 here以及其他答案。
Additionally, take a look at the timestamps. It appears to be random is consistent with the minute mark when my cron is called. Regardless of what it does though, appender's behavior is not consistent with its' description.
没错。翻转不会在“整点”发生,而是在翻转时间标记之后的第一个记录语句(因此是您的文件时间戳)。并且不检查翻转部分需要重命名的文件名是否可以免费使用。
关于java - DailyRollingFileAppender,丢失前一天的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7880364/
我使用 Log4j 编写一些日志我的程序。我在这个网站上找到并阅读了很多问题和答案,但无法解决我的问题。 这是我的代码: 1。 log4j.xml
第 1 天 程序开始并运行一整天。日志如期写入 第 2 天 当天的第一个 Activity 发生时午夜过后(一个 cron in我的情况)记录了 Activity ,第一天的所有数据都丢失了。此 Ac
对于DailyRollingFileAppender,我具有以下简单的Test类,以便每小时滚动日志文件。我面临的问题是,即使我将其设置为“ .'yyyy-MM-dd-HH”,它似乎也不每小时都会滚动
我有一个 log4j 配置,旨在当我的应用程序每天运行一次时滚动文件: log4j.rootLogger=INFO, filer log4j.appender.filer=org.apache.log
我的目标是使用 log4j 将(json 格式的)消息滚动到日志文件中,并使生成的日志文件成为 json 有效的结构。我目前在 log4j.properties 中拥有的是: log4j.rootLo
我正在使用基于 Web 的应用程序和 Log4J API 来进行日志记录。 在 Log4J 中,我使用 DailyRollingFileAppender 创建一个新的日志文件用于每天的日志记录。 这是
This answer表示日志保留 7 天。这是可配置的吗? 这Java Ranch Pos t 表示文件永远不会被删除。 本网站还同意永远不会删除日志文件: If you are trying to
在 Java 8 应用程序中使用 org.apache.log4j,我希望每小时创建一个新的日志文件,其名称例如:“mylog.log.2014-09-24-18”。我读到我需要使用 DailyRol
我们遇到了一个特殊的问题。场景:我们有 3 台服务器,其中有一个组件的多个实例,所有实例都将事务日志写入单个日志文件。我们使用 log4j,服务器在 Java 1.3 中运行。 setAppend()
我有一个使用 log4j 的 java 应用程序。 配置: log4j.rootLogger=info, file log4j.appender.file=org.apache.log4j.Daily
我有一个仅在由硬件触发时运行的应用程序。我们最近也添加了 log4cxx 的遗留 C++ 应用程序,以生成日志以帮助调试罕见的生产问题。我们当然想要每日日志文件。 事实证明,我们从来没有得到滚动文件。
我在logging.xml中有以下配置,问题是它在翻转中创建2并写入这两个文件。 例如在下面的配置中,我的服务器中有 Performance.log 和 Performance.log.2020.06
我的目标是每天生成日志文件,但MaxFileSize=100KB 所以我使用了 DailyRollingFileAppender,因为我使用的是 log4j 2.2 版本 日期工作正常,当我使用 Ma
有没有办法指定原始文件名的模式? 我本质上想做以下事情: 我该如何去做呢? 最佳答案 我有一个每日滚动日志,但我的做法有点不同,使用 log4j extras 中的 TimeBasedRolling
您好,我正在尝试使用 log4j DailyRollingFileAppender 将当前日期附加到文件名,但它不起作用。我使用了如下配置。请为此提出解决方案 属性 log4j.rootLogger
我想要每日日志,日志文件附加了 yyyy-dd-mm 格式的日期。当我使用 DailyRollingFileAppender 时,不会创建新的日志文件。日志被写入同一个日志文件。此外,不考虑提供的日期
有人可以告诉我如何在 DailyRollingFileAppender 中使用 MaxBackupIndex。我知道 RollingFileAppender 支持 maxBackupIndex 属性,
我知道log4j提供了RollingFileAppender和DailyRollingFileAppender类,但是,DailyRollingFileAppender不支持MaxFileSize属性
将 log4cplus 配置文件用于运行 dcmtk(DICOM 工具包)操作的 bash 脚本。日志记录有效,并在脚本运行时每分钟创建一个新日志(配置文件中的“每分钟”)。 “分钟”用于测试目的,一
我现在正在使用 Log4j,并想开始使用 Log4j 2。 我想创建一些 appender 来每天做一些事情(比如从日志文件创建 zip 文件),如果文件超过某个大小。 在 Log4j 中,我有 Da
我是一名优秀的程序员,十分优秀!