日志解析器进程不允许 log4j 轮换日志
我编写了一个日志解析器,它不断读取日志文件,从日志中获取特定行并将它们写入数据库。日志通过 LOG4J 生成。当日志达到特定大小时将进行旋转。我的问题是我的日志解析器进程不允许 log4j 轮换日志。
您能就此提出建议吗?
问候。
I wrote a log parser that constantly reads the log file gets specific lines from the log and writes them into database. Logs are generated via LOG4J. Logs are being rotated when they reach specific size. My problem is that my log parser process is not allowing log4j to rotate the logs.
Can you please advice on this.
Regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个更简洁的解决方案是对数据库中所需的日志语句使用 org.apache.log4j.jdbc.JDBCAppender,并让 log4j 直接插入它们。
A cleaner solution would be to use
org.apache.log4j.jdbc.JDBCAppender
for the log statements that you want in the database, and have log4j insert them directly.